gwnavruntime/navmesh/identifiers/navhalfedgerawptr.h Source File

navhalfedgerawptr.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 
9 // ---------- Primary contact: JUBA - secondary contact: NOBODY
10 #ifndef Navigation_NavHalfEdgeRawPtr_H
11 #define Navigation_NavHalfEdgeRawPtr_H
12 
16 
17 namespace Kaim
18 {
19 
21 // NavHalfEdgeRawPtr
23 
31 class NavHalfEdgeRawPtr
32 {
33  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavData)
34 
35 public:
38 
42  NavHalfEdgeRawPtr(const NavFloorRawPtr& navFloorRawPtr, NavHalfEdgeIdx halfEdgeIdx);
43 
47  NavHalfEdgeRawPtr(NavFloor* navFloor, NavHalfEdgeIdx halfEdgeIdx);
48 
49 
53  void Set(const NavFloorRawPtr& navFloorRawPtr, NavHalfEdgeIdx halfEdgeIdx);
54 
58  void Set(NavFloor* navFloor, NavHalfEdgeIdx halfEdgeIdx);
59 
61  bool IsValid() const;
62 
63  void Invalidate();
64 
65  bool operator==(const NavHalfEdgeRawPtr& rhs) const;
66  bool operator!=(const NavHalfEdgeRawPtr& rhs) const;
67 
69 
70  // ---------------------------------- Member Functions for valid instance ----------------------------------
73 
76  NavFloor* GetNavFloor() const;
77 
80  const NavFloorBlob* GetNavFloorBlob() const;
81 
85  const CellPos& GetCellPos() const;
86 
89  const NavTag& GetNavTag() const;
90 
96  void GetTriangleVerticesPos3f(Vec3f& v0Pos3f, Vec3f& v1Pos3f, Vec3f& v2Pos3f) const;
97 
102  void GetVerticesPos3f(Vec3f& v0Pos3f, Vec3f& v1Pos3f) const;
103 
106  Vec3f GetStartVertexPos3f() const;
107 
110  Vec3f GetEndVertexPos3f() const;
111 
115 
119 
123 
127 
131 
135 
139 
143  template<class TraverseLogic>
144  bool IsHalfEdgeCrossable(void* traverseLogicUserData) const;
145 
149  bool IsHalfEdgeCrossable() const;
150 
155  template<class TraverseLogic>
156  bool IsHalfEdgeCrossable(void* traverseLogicUserData, NavHalfEdgeRawPtr& resultRawPtr) const;
157 
162  bool IsHalfEdgeCrossable(NavHalfEdgeRawPtr& resultRawPtr) const;
163 
168  template<class TraverseLogic>
169  bool IsStartVertexOnBorder(void* traverseLogicUserData) const;
170 
174  bool IsStartVertexOnBorder() const;
175 
180  template<class TraverseLogic>
181  bool IsEndVertexOnBorder(void* traverseLogicUserData) const;
182 
186  bool IsEndVertexOnBorder() const;
187 
192  void GetPairHalfEdgeRawPtr(NavHalfEdgeRawPtr& resultRawPtr) const;
193 
196  void GetNextHalfEdgeRawPtr(NavHalfEdgeRawPtr& resultRawPtr) const;
197 
200  void GetPrevHalfEdgeRawPtr(NavHalfEdgeRawPtr& resultRawPtr) const;
201 
208  template<class TraverseLogic>
209  NavHalfEdgeRawPtr GetNextNavHalfEdgeRawPtrAlongBorder(void* traverseLogicUserData) const;
210 
217  template<class TraverseLogic>
218  NavHalfEdgeRawPtr GetPrevNavHalfEdgeRawPtrAlongBorder(void* traverseLogicUserData) const;
219 
220 public: // internal
221  NavHalfEdgeRawPtr& GetCorrespondingLink();
222 
223  template<class TraverseLogic>
224  bool IsHalfEdgeCrossable(void* traverseLogicUserData, const NavFloorBlob* navFloorBlob, NavHalfEdgeRawPtr& resultRawPtr) const;
225  template<class TraverseLogic>
226  bool IsHalfEdgeCrossable(void* traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob* navFloorBlob,
227  NavHalfEdgeRawPtr& resultRawPtr) const;
228  template<class TraverseLogic>
229  bool IsHalfEdgeCrossable(void* traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob* navFloorBlob,
230  NavHalfEdgeRawPtr& resultRawPtr, KyFloat32* costMultiplier) const;
231  template<class TraverseLogic>
232  bool IsHalfEdgeOneWayCrossable(void* traverseLogicUserData, const Vec3f* position) const;
233  template<class TraverseLogic>
234  bool IsHalfEdgeOneWayCrossable(void* traverseLogicUserData, NavHalfEdgeRawPtr& resultRawPtr, const Vec3f* position) const;
235  template<class TraverseLogic>
236  bool IsHalfEdgeOneWayCrossable(void* traverseLogicUserData, const NavFloorBlob* navFloorBlob,
237  NavHalfEdgeRawPtr& resultRawPtr, const Vec3f* position) const;
238  template<class TraverseLogic>
239  bool IsHalfEdgeOneWayCrossable(void* traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob* navFloorBlob,
240  NavHalfEdgeRawPtr& resultRawPtr, const Vec3f* position, KyFloat32* costMultiplier) const;
241  template<class TraverseLogic>
242  bool IsHalfEdgeOneWayCrossable(void* traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob* navFloorBlob,
243  NavHalfEdgeRawPtr& resultRawPtr, KyFloat32* costMultiplier) const;
244 
245  template<class TraverseLogic>
246  bool IsPairedEdgeCrossable(void* traverseLogicUserData, const NavFloorBlob* navFloorBlob, NavTriangleIdx pairTriangleIdx,
247  KyFloat32* /*costMultiplier*/, const LogicWithoutCostMultipler&) const;
248  template<class TraverseLogic>
249  bool IsPairedEdgeCrossable(void* traverseLogicUserData, const NavFloorBlob* navFloorBlob, NavTriangleIdx pairTriangleIdx,
250  KyFloat32* costMultiplier, const LogicWithCostMultiplerPerNavTag&) const;
251  template<class TraverseLogic>
252  bool IsPairedEdgeCrossable(void* traverseLogicUserData, const NavFloorBlob* navFloorBlob, NavTriangleIdx pairTriangleIdx,
253  KyFloat32* costMultiplier, const LogicWithCostMultiplerPerTriangle&) const;
254 
255  template<class TraverseLogic>
256  bool IsConnexBoundaryCrossable(void* traverseLogicUserData, const NavFloorBlob* navFloorBlob, NavTriangleIdx pairTriangleIdx,
257  KyFloat32* /*costMultiplier*/, const LogicWithoutCostMultipler&) const;
258  template<class TraverseLogic>
259  bool IsConnexBoundaryCrossable(void* traverseLogicUserData, const NavFloorBlob* navFloorBlob, NavTriangleIdx pairTriangleIdx,
260  KyFloat32* costMultiplier, const LogicWithCostMultiplerPerNavTag&) const;
261  template<class TraverseLogic>
262  bool IsConnexBoundaryCrossable(void* traverseLogicUserData, const NavFloorBlob* navFloorBlob, NavTriangleIdx pairTriangleIdx,
263  KyFloat32* costMultiplier, const LogicWithCostMultiplerPerTriangle&) const;
264 
265  template<class TLogic>
266  bool IsFloorOrCellLinkCrossable(void* traverseLogicUserData, const NavHalfEdgeRawPtr& link, KyFloat32* costMultiplier,
267  const LogicWithoutCostMultipler&) const;
268  template<class TLogic>
269  bool IsFloorOrCellLinkCrossable(void* traverseLogicUserData, const NavHalfEdgeRawPtr& link, KyFloat32* costMultiplier,
270  const LogicWithCostMultiplerPerNavTag&) const;
271  template<class TLogic>
272  bool IsFloorOrCellLinkCrossable(void* traverseLogicUserData, const NavHalfEdgeRawPtr& link, KyFloat32* costMultiplier,
273  const LogicWithCostMultiplerPerTriangle&) const;
274 
275  template<class TraverseLogic>
276  bool IsHalfEdgeOneWayCrossable(void* traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob* navFloorBlob, NavHalfEdgeRawPtr& resultRawPtr,
277  const Vec3f* position, KyFloat32* costMultiplier, const LogicDoNotUseCanEnterNavTag&) const;
278  template<class TraverseLogic>
279  bool IsHalfEdgeOneWayCrossable(void* traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob* navFloorBlob, NavHalfEdgeRawPtr& resultRawPtr,
280  const Vec3f* position, KyFloat32* costMultiplier, const LogicDoUseCanEnterNavTag&) const;
281 
282  void GetVerticesPos3f(KyFloat32 integerPrecision, const CoordPos64& cellOrigin, const NavFloorBlob* navFloorBlob, Vec3f& v0Pos3f, Vec3f& v1Pos3f) const;
283 public:
285  CompactNavHalfEdgeIdx m_halfEdgeIdx;
286 
288 };
289 
290 }
291 
292 #include "gwnavruntime/navmesh/identifiers/navhalfedgerawptr.inl"
293 
294 #endif //Navigation_NavHalfEdgeRawPtr_H
295 
bool IsValid() const
Returns true if this object refers to a valid edge: i.e. an edge in a validNavFloor. see NavFloorPtr::IsValid()
Definition: navhalfedgerawptr.inl:35
Vec3f GetStartVertexPos3f() const
Returns the coordinates of the starting vertex of this NavHalfEdge.
bool IsStartVertexOnBorder() const
Returns true if all the edges around the start vertex of this edge are neither an external boundary o...
Definition: navhalfedgerawptr.inl:307
KyUInt32 NavTriangleIdx
An index that uniquely identifies a single triangle within the set of triangles owned by a NavFloor...
Definition: navmeshtypes.h:100
NavHalfEdgeRawPtr GetNextNavHalfEdgeRawPtrAlongBorder(void *traverseLogicUserData) const
Returns the next edge along the border of the NavMesh according to TraverseLogic. ...
Definition: navhalfedgerawptr.inl:323
This class is a runtime wrapper of a NavFloorBlob, it gathers all the runtime information associated ...
Definition: navfloor.h:40
The NavFloorBlob contains a connected and not overlapping part of triangle mesh static data within a ...
Definition: navfloorblob.h:42
const NavTag & GetNavTag() const
Retrieves the NavTag associated to the NavFloor that contains this halfEdge.
Definition: navhalfedgerawptr.inl:62
void GetPrevHalfEdgeRawPtr(NavHalfEdgeRawPtr &resultRawPtr) const
Updates resultRawPtr to identify the previous edge in the triangle.
Definition: navhalfedgerawptr.inl:55
CompactNavHalfEdgeIdx m_halfEdgeIdx
The index of this edge within its NavFloor.
Definition: navhalfedgerawptr.h:297
NavHalfEdgeRawPtr GetPrevNavHalfEdgeRawPtrAlongBorder(void *traverseLogicUserData) const
Returns the previous edge along the border of the given NavTag.
Definition: navhalfedgerawptr.inl:341
void GetNextHalfEdgeRawPtr(NavHalfEdgeRawPtr &resultRawPtr) const
Updates resultRawPtr to identify the next edge in the triangle.
Definition: navhalfedgerawptr.inl:54
KyUInt32 NavHalfEdgeIdx
An index that uniquely identifies a single edge of a triangle within the set of edges owned by a NavF...
Definition: navmeshtypes.h:87
KyFloat32 GetStartVertexAltitude() const
Returns the altitude (z coordinate) of the starting vertex of this NavHalfEdge.
Definition: navhalfedgerawptr.inl:64
CoordPos GetStartVertexCoordPosInCell() const
Returns the 2D integer coordinates of the starting vertex of this edge in its NavCell.
Definition: navhalfedgerawptr.inl:51
void Set(const NavFloorRawPtr &navFloorRawPtr, NavHalfEdgeIdx halfEdgeIdx)
Clears all information maintained by this object.
Definition: navhalfedgerawptr.inl:18
This class defines a two-dimensional vector whose coordinates are stored using 64-bit integers...
Definition: vec2ll.h:27
void GetVerticesPos3f(Vec3f &v0Pos3f, Vec3f &v1Pos3f) const
Updates the parameters to identify the start and end vertices of the specified edge.
const CellPos & GetCellPos() const
Returns a const reference to the CellPos that indicates the position of the cell that contains this e...
Definition: navhalfedgerawptr.inl:60
CoordPos64 GetEndVertexCoordPos64() const
Returns the x,y integer coordinates of the ending vertex of this NavHalfEdge.
NavHalfEdgeIdx GetHalfEdgeIdx() const
Retrieves the index of this NavHalfEdge within its NavFloor.
Definition: navhalfedgerawptr.inl:57
bool IsEndVertexOnBorder() const
Returns true if all the edges around the end vertex of this edge are neither an external boundary of ...
Vec3f GetEndVertexPos3f() const
Returns the coordinates of the ending vertex of this NavHalfEdge.
This class defines a two-dimensional vector whose coordinates are stored using 32-bit integers...
Definition: vec2i.h:26
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
CoordPos GetEndVertexCoordPosInCell() const
Returns the 2D integer coordinates of the ending vertex of this edge in its NavCell.
Definition: navhalfedgerawptr.inl:52
const NavFloorBlob * GetNavFloorBlob() const
Returns a reference to the NavFloorBlob that contains this edge.
Definition: navhalfedgerawptr.inl:59
void GetPairHalfEdgeRawPtr(NavHalfEdgeRawPtr &resultRawPtr) const
Updates resultRawPtr to identify the edge in the next adjacent triangle that borders this edge...
KyFloat32 GetEndVertexAltitude() const
Returns the altitude (z coordinate) of the ending vertex of this NavHalfEdge.
Definition: navhalfedgerawptr.inl:69
Each instance of NavHalfEdge represents a single edge of a single triangle within the NavMesh...
Definition: navhalfedge.h:21
NavFloor * GetNavFloor() const
Returns a reference to the NavFloor that contains this hedge.
Definition: navhalfedgerawptr.inl:58
void GetTriangleVerticesPos3f(Vec3f &v0Pos3f, Vec3f &v1Pos3f, Vec3f &v2Pos3f) const
Updates the parameters to identify the vertices in the specified triangle.
unsigned short KyUInt16
Type used internally to represent an unsigned 16-bit integer.
Definition: types.h:40
bool IsHalfEdgeCrossable() const
Returns true if this edge is not on an external boundary of the NavMesh and not a internal edge that ...
Definition: navhalfedgerawptr.inl:317
void Invalidate()
Invalidates this object.
Definition: navhalfedgerawptr.inl:36
KyUInt16 m_boundaryEdgeIdx
Use internally to speed up stitching. Do not modify.
Definition: navhalfedgerawptr.h:299
CoordPos64 GetStartVertexCoordPos64() const
Returns the x,y integer coordinates of the starting vertex of this NavHalfEdge.
Each instance of this class uniquely identifies a singleNavHalfEdge in a NavFloor.
Definition: navhalfedgerawptr.h:34
NavFloorRawPtr m_navFloorRawPtr
The NavFloor that contains this edge.
Definition: navhalfedgerawptr.h:296
Vec3f GetMiddlePos3fOfNavHalfEdge() const
Computes and returns the coordinates of the middle position of this NavHalfEdge.
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23
Each instance of this class uniquely identifies a single NavFloor.
Definition: navfloorrawptr.h:30