Kaim::NavHalfEdgePtr Class Reference

Kaim::NavHalfEdgePtr Class Reference

#include <navhalfedgeptr.h>

Class Description

Each instance of this class uniquely identifies a single NavHalfEdge in a NavFloor.

Instances of this class can be safely stored and used in subsequent frames.

Public Member Functions

 NavHalfEdgePtr ()
 Creates an invalid NavHalfEdgePtr. More...
 
 NavHalfEdgePtr (const NavFloorPtr &navFloorPtr, NavHalfEdgeIdx halfEdgeIdx)
 Creates a new NavHalfEdgePtr referring to the provided NavHalfEdgeIdx in the provided NavFloorPtr. More...
 
 NavHalfEdgePtr (const NavHalfEdgeRawPtr &navHalfEdgeRawPtr)
 Creates a new NavHalfEdgePtr copying information from the provided one. More...
 
void Set (const NavFloorPtr &navFloorPtr, NavHalfEdgeIdx halfEdgeIdx)
 Clears all information maintained by this object. More...
 
bool IsValid () const
 Returns true if this object refers to a valid edge: i.e. an edge in a valid NavFloor. see NavFloorPtr::IsValid() More...
 
void Invalidate ()
 Invalidates this object. More...
 
bool operator== (const NavHalfEdgePtr &rhs) const
 Returns true if this object identifies the same edge as rhs, or if both are invalid. More...
 
bool operator!= (const NavHalfEdgePtr &rhs) const
 Returns true if this object identifies a different edge from rhs. More...
 
NavHalfEdgeIdx GetHalfEdgeIdx () const
 Returns the index of this edge within its NavFloor. More...
 
NavFloorGetNavFloor () const
 Returns a pointer to the NavFloor that contains this edge. Returns nullptr if this object is not valid. More...
 
const NavFloorBlobGetNavFloorBlob () const
 Returns a const pointer to the NavFloorBlob that contains this edge. Returns nullptr if this object is not valid. More...
 

Public Attributes

NavFloorPtr m_navFloorPtr
 The NavFloor that contains this edge. More...
 
CompactNavHalfEdgeIdx m_halfEdgeIdx
 The index of this edge within its NavFloor. More...
 

Member Functions for valid instance

NavFloorGetNavFloor_Unsafe () const
 All these function should be called only if IsValid() returns true. More...
 
const NavFloorBlobGetNavFloorBlob_Unsafe () const
 Returns a const pointer to the NavFloorBlob that contains this edge. More...
 
NavHalfEdgeRawPtr GetRawPtr () const
 Constructs and returns a NavHalfEdgeRawPtr that refers to the same NavHalfEdge. More...
 
const CellPosGetCellPos () const
 Returns a const reference to the CellPos that indicates the position of the cell that contains this edge within the grid of NavData cells. More...
 
const NavTag & GetNavTag () const
 Retrieves the NavTag associated to the NavFloor that contains this halfEdge. More...
 
void GetTriangleVerticesPos3f (Vec3f &v0Pos3f, Vec3f &v1Pos3f, Vec3f &v2Pos3f) const
 Updates the parameters to identify the vertices in the specified triangle. More...
 
void GetVerticesPos3f (Vec3f &v0Pos3f, Vec3f &v1Pos3f) const
 Updates the parameters to identify the start and end vertices of the specified edge. More...
 
Vec3f GetStartVertexPos3f () const
 Returns the coordinates of the starting vertex of this NavHalfEdge. More...
 
Vec3f GetEndVertexPos3f () const
 Returns the coordinates of the ending vertex of this NavHalfEdge. More...
 
CoordPos64 GetStartVertexCoordPos64 () const
 Returns the x,y integer coordinates of the starting vertex of this NavHalfEdge. More...
 
CoordPos64 GetEndVertexCoordPos64 () const
 Returns the x,y integer coordinates of the ending vertex of this NavHalfEdge. More...
 
KyFloat32 GetStartVertexAltitude () const
 Returns the altitude (z coordinate) of the starting vertex of this NavHalfEdge. More...
 
KyFloat32 GetEndVertexAltitude () const
 Returns the altitude (z coordinate) of the ending vertex of this NavHalfEdge. More...
 
CoordPos GetStartVertexCoordPosInCell () const
 Returns the 2D integer coordinates of the starting vertex of this edge in its NavCell. More...
 
CoordPos GetEndVertexCoordPosInCell () const
 Returns the 2D integer coordinates of the ending vertex of this edge in its NavCell. More...
 
template<class TraverseLogic >
bool IsHalfEdgeCrossable (void *traverseLogicUserData) const
 Returns true if this edge can be traversed according the TraverseLogic. More...
 
bool IsHalfEdgeCrossable () const
 Returns true if this edge is not on an external boundary of the NavMesh and not a internal edge that is not correctly stitched. More...
 
template<class TraverseLogic >
bool IsHalfEdgeCrossable (NavHalfEdgePtr &resultPtr, void *traverseLogicUserData) const
 Returns true if this edge can be traversed according the TraverseLogic and updates resultPtr. More...
 
bool IsHalfEdgeCrossable (NavHalfEdgePtr &resultPtr) const
 Returns true if this edge is not on an external boundary of the NavMesh and not a internal edge that is not correctly stitched, and updates resultPtr. More...
 
void GetPairHalfEdgePtr (NavHalfEdgePtr &resultPtr) const
 Updates resultPtr to identify the edge in the next adjacent triangle that borders this edge. More...
 
void GetNextHalfEdgePtr (NavHalfEdgePtr &resultPtr) const
 Updates resultPtr to identify the next edge in the triangle. More...
 
void GetPrevHalfEdgePtr (NavHalfEdgePtr &resultPtr) const
 Updates resultPtr to identify the previous edge in the triangle. More...
 
template<class TraverseLogic >
NavHalfEdgePtr GetNextNavHalfEdgePtrAlongBorder (void *traverseLogicUserData) const
 Returns the next edge along the border of the NavMesh according to TraverseLogic. More...
 
template<class TraverseLogic >
NavHalfEdgePtr GetPrevNavHalfEdgePtrAlongBorder (void *traverseLogicUserData) const
 Returns the previous edge along the border of the NavMesh according to TraverseLogic. More...
 

Constructor & Destructor Documentation

Kaim::NavHalfEdgePtr::NavHalfEdgePtr ( )
inline

Creates an invalid NavHalfEdgePtr.

Kaim::NavHalfEdgePtr::NavHalfEdgePtr ( const NavFloorPtr navFloorPtr,
NavHalfEdgeIdx  halfEdgeIdx 
)
inline

Creates a new NavHalfEdgePtr referring to the provided NavHalfEdgeIdx in the provided NavFloorPtr.

Parameters
navFloorPtrThe NavFloor that contains the edge this object should refer to.
halfEdgeIdxThe index of this edge within the NavFloor.
Kaim::NavHalfEdgePtr::NavHalfEdgePtr ( const NavHalfEdgeRawPtr navHalfEdgeRawPtr)
inlineexplicit

Creates a new NavHalfEdgePtr copying information from the provided one.

Member Function Documentation

const CellPos & Kaim::NavHalfEdgePtr::GetCellPos ( ) const
inline

Returns a const reference to the CellPos that indicates the position of the cell that contains this edge within the grid of NavData cells.

Precondition
This object must be valid. Its validity is not checked.
KyFloat32 Kaim::NavHalfEdgePtr::GetEndVertexAltitude ( ) const
inline

Returns the altitude (z coordinate) of the ending vertex of this NavHalfEdge.

Precondition
This object must be valid. Its validity is not checked
CoordPos64 Kaim::NavHalfEdgePtr::GetEndVertexCoordPos64 ( ) const
inline

Returns the x,y integer coordinates of the ending vertex of this NavHalfEdge.

Precondition
This object must be valid. Its validity is not checked.
CoordPos Kaim::NavHalfEdgePtr::GetEndVertexCoordPosInCell ( ) const
inline

Returns the 2D integer coordinates of the ending vertex of this edge in its NavCell.

Precondition
This object must be valid. Its validity is not checked.
Vec3f Kaim::NavHalfEdgePtr::GetEndVertexPos3f ( ) const
inline

Returns the coordinates of the ending vertex of this NavHalfEdge.

Precondition
This object must be valid. Its validity is not checked.
NavHalfEdgeIdx Kaim::NavHalfEdgePtr::GetHalfEdgeIdx ( ) const
inline

Returns the index of this edge within its NavFloor.

NavFloor * Kaim::NavHalfEdgePtr::GetNavFloor ( ) const
inline

Returns a pointer to the NavFloor that contains this edge. Returns nullptr if this object is not valid.

NavFloor * Kaim::NavHalfEdgePtr::GetNavFloor_Unsafe ( ) const
inline

All these function should be called only if IsValid() returns true.

Precondition
This object must be valid. Its validity is not checked. Returns a pointer to the NavFloor that contains this edge.
This object must be valid. Its validity is not checked.
const NavFloorBlob * Kaim::NavHalfEdgePtr::GetNavFloorBlob ( ) const
inline

Returns a const pointer to the NavFloorBlob that contains this edge. Returns nullptr if this object is not valid.

const NavFloorBlob * Kaim::NavHalfEdgePtr::GetNavFloorBlob_Unsafe ( ) const
inline

Returns a const pointer to the NavFloorBlob that contains this edge.

Precondition
This object must be valid. Its validity is not checked.
const NavTag & Kaim::NavHalfEdgePtr::GetNavTag ( ) const
inline

Retrieves the NavTag associated to the NavFloor that contains this halfEdge.

Precondition
This object must be valid. Its validity is not checked.
void Kaim::NavHalfEdgePtr::GetNextHalfEdgePtr ( NavHalfEdgePtr resultPtr) const
inline

Updates resultPtr to identify the next edge in the triangle.

Precondition
This object must be valid. Its validity is not checked.
template<class TraverseLogic >
NavHalfEdgePtr Kaim::NavHalfEdgePtr::GetNextNavHalfEdgePtrAlongBorder ( void *  traverseLogicUserData) const
inline

Returns the next edge along the border of the NavMesh according to TraverseLogic.

Parameters
traverseLogicUserDataA pointer to a traverseLogicUserData
Precondition
This object must be valid. Its validity is not checked.
This object must be on the border of an area of the NavMesh according to TraverseLogic. It may not be paired with another triangle with a traversable NavTag. That means we must have IsHalfEdgeCrossable<TraverseLogic>() == false.
Postcondition
The returned edge is not paired with another triangle with a traversable NavTag.
void Kaim::NavHalfEdgePtr::GetPairHalfEdgePtr ( NavHalfEdgePtr resultPtr) const
inline

Updates resultPtr to identify the edge in the next adjacent triangle that borders this edge.

Precondition
This object must be valid. Its validity is not checked.
The type of the edge returned by a call to NavHalfEdge::GetHalfEdgeType() must not be EDGETYPE_OBSTACLE.
void Kaim::NavHalfEdgePtr::GetPrevHalfEdgePtr ( NavHalfEdgePtr resultPtr) const
inline

Updates resultPtr to identify the previous edge in the triangle.

Precondition
This object must be valid. Its validity is not checked.
template<class TraverseLogic >
NavHalfEdgePtr Kaim::NavHalfEdgePtr::GetPrevNavHalfEdgePtrAlongBorder ( void *  traverseLogicUserData) const
inline

Returns the previous edge along the border of the NavMesh according to TraverseLogic.

Parameters
traverseLogicUserDataA pointer to a traverseLogicUserData
Precondition
This object must be valid. Its validity is not checked.
This object must be on the border of an area of the NavMesh according to TraverseLogic. It may not be paired with another triangle with a traversable NavTag. That means we must have IsHalfEdgeCrossable<TraverseLogic>() == false.
Postcondition
The returned edge is not paired with another triangle with a traversable NavTag.
NavHalfEdgeRawPtr Kaim::NavHalfEdgePtr::GetRawPtr ( ) const
inline

Constructs and returns a NavHalfEdgeRawPtr that refers to the same NavHalfEdge.

Precondition
This object must be valid. Its validity is not checked.
KyFloat32 Kaim::NavHalfEdgePtr::GetStartVertexAltitude ( ) const
inline

Returns the altitude (z coordinate) of the starting vertex of this NavHalfEdge.

Precondition
This object must be valid. Its validity is not checked
CoordPos64 Kaim::NavHalfEdgePtr::GetStartVertexCoordPos64 ( ) const
inline

Returns the x,y integer coordinates of the starting vertex of this NavHalfEdge.

Precondition
This object must be valid. Its validity is not checked.
CoordPos Kaim::NavHalfEdgePtr::GetStartVertexCoordPosInCell ( ) const
inline

Returns the 2D integer coordinates of the starting vertex of this edge in its NavCell.

Precondition
This object must be valid. Its validity is not checked.
Vec3f Kaim::NavHalfEdgePtr::GetStartVertexPos3f ( ) const
inline

Returns the coordinates of the starting vertex of this NavHalfEdge.

Precondition
This object must be valid. Its validity is not checked.
void Kaim::NavHalfEdgePtr::GetTriangleVerticesPos3f ( Vec3f v0Pos3f,
Vec3f v1Pos3f,
Vec3f v2Pos3f 
) const
inline

Updates the parameters to identify the vertices in the specified triangle.

Parameters
[out]v0Pos3fThe 3D position of the start vertex of the edge.
[out]v1Pos3fThe 3D position of the end vertex in the edge.
[out]v2Pos3fThe 3D position of the third vertex in the triangle.
Precondition
This object must be valid. Its validity is not checked.
void Kaim::NavHalfEdgePtr::GetVerticesPos3f ( Vec3f v0Pos3f,
Vec3f v1Pos3f 
) const
inline

Updates the parameters to identify the start and end vertices of the specified edge.

Parameters
[out]v0Pos3fThe 3D position of the start vertex of the edge.
[out]v1Pos3fThe 3D position of the end vertex in the edge.
Precondition
This object must be valid. Its validity is not checked.
void Kaim::NavHalfEdgePtr::Invalidate ( )
inline

Invalidates this object.

template<class TraverseLogic >
bool Kaim::NavHalfEdgePtr::IsHalfEdgeCrossable ( void *  traverseLogicUserData) const
inline

Returns true if this edge can be traversed according the TraverseLogic.

Parameters
traverseLogicUserDataA pointer to a traverseLogicUserData
Precondition
This object must be valid. Its validity is not checked.
bool Kaim::NavHalfEdgePtr::IsHalfEdgeCrossable ( ) const
inline

Returns true if this edge is not on an external boundary of the NavMesh and not a internal edge that is not correctly stitched.

Precondition
This object must be valid. Its validity is not checked.
template<class TraverseLogic >
bool Kaim::NavHalfEdgePtr::IsHalfEdgeCrossable ( NavHalfEdgePtr resultPtr,
void *  traverseLogicUserData 
) const
inline

Returns true if this edge can be traversed according the TraverseLogic and updates resultPtr.

Parameters
[out]resultPtrThe edge in the next adjacent triangle that borders this edge.
traverseLogicUserDataA pointer to a traverseLogicUserData
Precondition
This object must be valid. Its validity is not checked.
bool Kaim::NavHalfEdgePtr::IsHalfEdgeCrossable ( NavHalfEdgePtr resultPtr) const
inline

Returns true if this edge is not on an external boundary of the NavMesh and not a internal edge that is not correctly stitched, and updates resultPtr.

Parameters
[out]resultPtrThe edge in the next adjacent triangle that borders this edge.
Precondition
This object must be valid. Its validity is not checked.
bool Kaim::NavHalfEdgePtr::IsValid ( ) const
inline

Returns true if this object refers to a valid edge: i.e. an edge in a valid NavFloor. see NavFloorPtr::IsValid()

bool Kaim::NavHalfEdgePtr::operator!= ( const NavHalfEdgePtr rhs) const
inline

Returns true if this object identifies a different edge from rhs.

bool Kaim::NavHalfEdgePtr::operator== ( const NavHalfEdgePtr rhs) const
inline

Returns true if this object identifies the same edge as rhs, or if both are invalid.

void Kaim::NavHalfEdgePtr::Set ( const NavFloorPtr navFloorPtr,
NavHalfEdgeIdx  halfEdgeIdx 
)
inline

Clears all information maintained by this object.

Parameters
navFloorPtrThe NavFloor that contains the edge this object should refer to.
halfEdgeIdxThe index of this edge within the NavFloor.

Member Data Documentation

CompactNavHalfEdgeIdx Kaim::NavHalfEdgePtr::m_halfEdgeIdx

The index of this edge within its NavFloor.

NavFloorPtr Kaim::NavHalfEdgePtr::m_navFloorPtr

The NavFloor that contains this edge.


The documentation for this class was generated from the following file: