Kaim::NavHalfEdgeRawPtr Class Reference

Kaim::NavHalfEdgeRawPtr Class Reference

#include <navhalfedgerawptr.h>

Class Description

Each instance of this class uniquely identifies a singleNavHalfEdge in a NavFloor.

This pointer is guaranteed to be valid only in the frame in which it was retrieved.

Never store a NavHalfEdgeRawPtr for use in subsequent frames, because it has no protection against data streaming. Use NavHalfEdgePtr instead.

Actually, this class is used internally for some performance and working memory usage friendliness reason (no ref-counting increment/decrement, no need to call constructor/destructor), but unless you really know what you do prefer NavHalfEdgePtr which is safer.

+ Examples:

Public Member Functions

 NavHalfEdgeRawPtr ()
 
 NavHalfEdgeRawPtr (const NavFloorRawPtr &navFloorRawPtr, NavHalfEdgeIdx halfEdgeIdx)
 
 NavHalfEdgeRawPtr (NavFloor *navFloor, NavHalfEdgeIdx halfEdgeIdx)
 
NavHalfEdgeIdx GetHalfEdgeIdx () const
 
void Invalidate ()
 
bool IsValid () const
 
bool operator!= (const NavHalfEdgeRawPtr &rhs) const
 
bool operator== (const NavHalfEdgeRawPtr &rhs) const
 
void Set (const NavFloorRawPtr &navFloorRawPtr, NavHalfEdgeIdx halfEdgeIdx)
 
void Set (NavFloor *navFloor, NavHalfEdgeIdx halfEdgeIdx)
 

Public Attributes

KyUInt16 m_boundaryEdgeIdx
 
CompactNavHalfEdgeIdx m_halfEdgeIdx
 
NavFloorRawPtr m_navFloorRawPtr
 

Member Functions for valid instance

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

Precondition
This object must be valid. Its validity is not checked.
NavFloorGetNavFloor () const
 
const NavFloorBlobGetNavFloorBlob () const
 
const CellPosGetCellPos () const
 
const NavTag & GetNavTag () const
 
void GetTriangleVerticesPos3f (Vec3f &v0Pos3f, Vec3f &v1Pos3f, Vec3f &v2Pos3f) const
 
void GetVerticesPos3f (Vec3f &v0Pos3f, Vec3f &v1Pos3f) const
 
Vec3f GetStartVertexPos3f () const
 
Vec3f GetEndVertexPos3f () const
 
Vec3f GetMiddlePos3fOfNavHalfEdge () const
 
CoordPos64 GetStartVertexCoordPos64 () const
 
CoordPos64 GetEndVertexCoordPos64 () const
 
KyFloat32 GetStartVertexAltitude () const
 
KyFloat32 GetEndVertexAltitude () const
 
CoordPos GetStartVertexCoordPosInCell () const
 
CoordPos GetEndVertexCoordPosInCell () const
 
template<class TraverseLogic >
bool IsHalfEdgeCrossable (void *traverseLogicUserData) const
 
bool IsHalfEdgeCrossable () const
 
template<class TraverseLogic >
bool IsHalfEdgeCrossable (void *traverseLogicUserData, NavHalfEdgeRawPtr &resultRawPtr) const
 
bool IsHalfEdgeCrossable (NavHalfEdgeRawPtr &resultRawPtr) const
 
template<class TraverseLogic >
bool IsStartVertexOnBorder (void *traverseLogicUserData) const
 
bool IsStartVertexOnBorder () const
 
template<class TraverseLogic >
bool IsEndVertexOnBorder (void *traverseLogicUserData) const
 
bool IsEndVertexOnBorder () const
 
void GetPairHalfEdgeRawPtr (NavHalfEdgeRawPtr &resultRawPtr) const
 
void GetNextHalfEdgeRawPtr (NavHalfEdgeRawPtr &resultRawPtr) const
 
void GetPrevHalfEdgeRawPtr (NavHalfEdgeRawPtr &resultRawPtr) const
 
template<class TraverseLogic >
NavHalfEdgeRawPtr GetNextNavHalfEdgeRawPtrAlongBorder (void *traverseLogicUserData) const
 
template<class TraverseLogic >
NavHalfEdgeRawPtr GetPrevNavHalfEdgeRawPtrAlongBorder (void *traverseLogicUserData) const
 

For internal use only

NavHalfEdgeRawPtrGetCorrespondingLink ()
 
template<class TraverseLogic >
bool IsHalfEdgeCrossable (void *traverseLogicUserData, const NavFloorBlob *navFloorBlob, NavHalfEdgeRawPtr &resultRawPtr) const
 
template<class TraverseLogic >
bool IsHalfEdgeCrossable (void *traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob *navFloorBlob, NavHalfEdgeRawPtr &resultRawPtr) const
 
template<class TraverseLogic >
bool IsHalfEdgeCrossable (void *traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob *navFloorBlob, NavHalfEdgeRawPtr &resultRawPtr, KyFloat32 *costMultiplier) const
 
template<class TraverseLogic >
bool IsHalfEdgeOneWayCrossable (void *traverseLogicUserData, const Vec3f *position) const
 
template<class TraverseLogic >
bool IsHalfEdgeOneWayCrossable (void *traverseLogicUserData, NavHalfEdgeRawPtr &resultRawPtr, const Vec3f *position) const
 
template<class TraverseLogic >
bool IsHalfEdgeOneWayCrossable (void *traverseLogicUserData, const NavFloorBlob *navFloorBlob, NavHalfEdgeRawPtr &resultRawPtr, const Vec3f *position) const
 
template<class TraverseLogic >
bool IsHalfEdgeOneWayCrossable (void *traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob *navFloorBlob, NavHalfEdgeRawPtr &resultRawPtr, const Vec3f *position, KyFloat32 *costMultiplier) const
 
template<class TraverseLogic >
bool IsHalfEdgeOneWayCrossable (void *traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob *navFloorBlob, NavHalfEdgeRawPtr &resultRawPtr, KyFloat32 *costMultiplier) const
 
template<class TraverseLogic >
bool IsPairedEdgeCrossable (void *traverseLogicUserData, const NavFloorBlob *navFloorBlob, NavTriangleIdx pairTriangleIdx, KyFloat32 *, const LogicWithoutCostMultipler &) const
 
template<class TraverseLogic >
bool IsPairedEdgeCrossable (void *traverseLogicUserData, const NavFloorBlob *navFloorBlob, NavTriangleIdx pairTriangleIdx, KyFloat32 *costMultiplier, const LogicWithCostMultiplerPerNavTag &) const
 
template<class TraverseLogic >
bool IsPairedEdgeCrossable (void *traverseLogicUserData, const NavFloorBlob *navFloorBlob, NavTriangleIdx pairTriangleIdx, KyFloat32 *costMultiplier, const LogicWithCostMultiplerPerTriangle &) const
 
template<class TraverseLogic >
bool IsConnexBoundaryCrossable (void *traverseLogicUserData, const NavFloorBlob *navFloorBlob, NavTriangleIdx pairTriangleIdx, KyFloat32 *, const LogicWithoutCostMultipler &) const
 
template<class TraverseLogic >
bool IsConnexBoundaryCrossable (void *traverseLogicUserData, const NavFloorBlob *navFloorBlob, NavTriangleIdx pairTriangleIdx, KyFloat32 *costMultiplier, const LogicWithCostMultiplerPerNavTag &) const
 
template<class TraverseLogic >
bool IsConnexBoundaryCrossable (void *traverseLogicUserData, const NavFloorBlob *navFloorBlob, NavTriangleIdx pairTriangleIdx, KyFloat32 *costMultiplier, const LogicWithCostMultiplerPerTriangle &) const
 
template<class TLogic >
bool IsFloorOrCellLinkCrossable (void *traverseLogicUserData, const NavHalfEdgeRawPtr &link, KyFloat32 *costMultiplier, const LogicWithoutCostMultipler &) const
 
template<class TLogic >
bool IsFloorOrCellLinkCrossable (void *traverseLogicUserData, const NavHalfEdgeRawPtr &link, KyFloat32 *costMultiplier, const LogicWithCostMultiplerPerNavTag &) const
 
template<class TLogic >
bool IsFloorOrCellLinkCrossable (void *traverseLogicUserData, const NavHalfEdgeRawPtr &link, KyFloat32 *costMultiplier, const LogicWithCostMultiplerPerTriangle &) const
 
template<class TraverseLogic >
bool IsHalfEdgeOneWayCrossable (void *traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob *navFloorBlob, NavHalfEdgeRawPtr &resultRawPtr, const Vec3f *position, KyFloat32 *costMultiplier, const LogicDoNotUseCanEnterNavTag &) const
 
template<class TraverseLogic >
bool IsHalfEdgeOneWayCrossable (void *traverseLogicUserData, NavHalfEdge navHalfEdge, const NavFloorBlob *navFloorBlob, NavHalfEdgeRawPtr &resultRawPtr, const Vec3f *position, KyFloat32 *costMultiplier, const LogicDoUseCanEnterNavTag &) const
 
void GetVerticesPos3f (KyFloat32 integerPrecision, const CoordPos64 &cellOrigin, const NavFloorBlob *navFloorBlob, Vec3f &v0Pos3f, Vec3f &v1Pos3f) const
 

Constructor & Destructor Documentation

Kaim::NavHalfEdgeRawPtr::NavHalfEdgeRawPtr ( )
inline

Creates an invalid NavHalfEdgeRawPtr.

Kaim::NavHalfEdgeRawPtr::NavHalfEdgeRawPtr ( const NavFloorRawPtr navFloorRawPtr,
NavHalfEdgeIdx  halfEdgeIdx 
)
inline

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

Parameters
navFloorRawPtrThe NavFloor that contains the edge this object should refer to.
halfEdgeIdxThe index of this edge within the NavFloor.
Kaim::NavHalfEdgeRawPtr::NavHalfEdgeRawPtr ( NavFloor navFloor,
NavHalfEdgeIdx  halfEdgeIdx 
)
inline

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

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

Member Function Documentation

const CellPos & Kaim::NavHalfEdgeRawPtr::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::NavHalfEdgeRawPtr::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::NavHalfEdgeRawPtr::GetEndVertexCoordPos64 ( ) const

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::NavHalfEdgeRawPtr::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::NavHalfEdgeRawPtr::GetEndVertexPos3f ( ) const

Returns the coordinates of the ending vertex of this NavHalfEdge.

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

Retrieves the index of this NavHalfEdge within its NavFloor.

+ Examples:
Vec3f Kaim::NavHalfEdgeRawPtr::GetMiddlePos3fOfNavHalfEdge ( ) const

Computes and returns the coordinates of the middle position of this NavHalfEdge.

Precondition
This object must be valid. Its validity is not checked.
NavFloor * Kaim::NavHalfEdgeRawPtr::GetNavFloor ( ) const
inline

Returns a reference to the NavFloor that contains this hedge.

Precondition
This object must be valid. Its validity is not checked.
+ Examples:
const NavFloorBlob * Kaim::NavHalfEdgeRawPtr::GetNavFloorBlob ( ) const
inline

Returns a reference to the NavFloorBlob that contains this edge.

Precondition
This object must be valid. Its validity is not checked.
const NavTag & Kaim::NavHalfEdgeRawPtr::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::NavHalfEdgeRawPtr::GetNextHalfEdgeRawPtr ( NavHalfEdgeRawPtr resultRawPtr) const
inline

Updates resultRawPtr to identify the next edge in the triangle.

Precondition
This object must be valid. Its validity is not checked.
template<class TLogic >
NavHalfEdgeRawPtr Kaim::NavHalfEdgeRawPtr::GetNextNavHalfEdgeRawPtrAlongBorder ( 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 (IsHalfEdgeCrossable<TraverseLogic>() == false).
void Kaim::NavHalfEdgeRawPtr::GetPairHalfEdgeRawPtr ( NavHalfEdgeRawPtr resultRawPtr) const

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

Parameters
[out]resultRawPtrUpdated to store the next adjacent triangle.
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::NavHalfEdgeRawPtr::GetPrevHalfEdgeRawPtr ( NavHalfEdgeRawPtr resultRawPtr) const
inline

Updates resultRawPtr to identify the previous edge in the triangle.

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

Returns the previous edge along the border of the given NavTag.

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 NavTagv. That means we must have IsHalfEdgeCrossable<TraverseLogic>() == false.
Postcondition
The returned edge is not paired with another triangle with a traversable NavTag (IsHalfEdgeCrossable<TraverseLogic>() == false).
KyFloat32 Kaim::NavHalfEdgeRawPtr::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::NavHalfEdgeRawPtr::GetStartVertexCoordPos64 ( ) const

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::NavHalfEdgeRawPtr::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::NavHalfEdgeRawPtr::GetStartVertexPos3f ( ) const

Returns the coordinates of the starting vertex of this NavHalfEdge.

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

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::NavHalfEdgeRawPtr::GetVerticesPos3f ( Vec3f v0Pos3f,
Vec3f v1Pos3f 
) const

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::NavHalfEdgeRawPtr::Invalidate ( )
inline

Invalidates this object.

template<class TraverseLogic >
bool Kaim::NavHalfEdgeRawPtr::IsEndVertexOnBorder ( void *  traverseLogicUserData) const

Returns true if all the edges around the end vertex of this edge can be traversed accordingly to the TraverseLogic.

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

Returns true if all the edges around the end vertex of this edge are neither an external boundary of the NavMesh nor an internal edge that is not correctly stitched.

Precondition
This object must be valid. Its validity is not checked.
template<class TLogic >
bool Kaim::NavHalfEdgeRawPtr::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.
+ Examples:
bool Kaim::NavHalfEdgeRawPtr::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 TLogic >
bool Kaim::NavHalfEdgeRawPtr::IsHalfEdgeCrossable ( void *  traverseLogicUserData,
NavHalfEdgeRawPtr resultRawPtr 
) const
inline

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

Parameters
[out]resultRawPtrThe 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::NavHalfEdgeRawPtr::IsHalfEdgeCrossable ( NavHalfEdgeRawPtr resultRawPtr) 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 resultRawPtr.

Parameters
[out]resultRawPtrThe edge in the next adjacent triangle that borders this edge.
Precondition
This object must be valid. Its validity is not checked.
template<class TLogic >
bool Kaim::NavHalfEdgeRawPtr::IsStartVertexOnBorder ( void *  traverseLogicUserData) const
inline

Returns true if all the edges around the start vertex of this edge can be traversed accordingly to the TraverseLogic.

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

Returns true if all the edges around the start vertex of this edge are neither an external boundary of the NavMesh nor an internal edge that is not correctly stitched.

Precondition
This object must be valid. Its validity is not checked.
bool Kaim::NavHalfEdgeRawPtr::IsValid ( ) const
inline

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

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

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

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

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

void Kaim::NavHalfEdgeRawPtr::Set ( const NavFloorRawPtr navFloorRawPtr,
NavHalfEdgeIdx  halfEdgeIdx 
)
inline

Clears all information maintained by this object.

Parameters
navFloorRawPtrThe NavFloor that contains the edge this object should refer to.
halfEdgeIdxThe index of this edge within the NavFloor.
void Kaim::NavHalfEdgeRawPtr::Set ( NavFloor navFloor,
NavHalfEdgeIdx  halfEdgeIdx 
)
inline

Clears all information maintained by this object.

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

Member Data Documentation

KyUInt16 Kaim::NavHalfEdgeRawPtr::m_boundaryEdgeIdx

Use internally to speed up stitching. Do not modify.

CompactNavHalfEdgeIdx Kaim::NavHalfEdgeRawPtr::m_halfEdgeIdx

The index of this edge within its NavFloor.

NavFloorRawPtr Kaim::NavHalfEdgeRawPtr::m_navFloorRawPtr

The NavFloor that contains this edge.


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