Kaim::NavTriangleRawPtr Class Reference

Kaim::NavTriangleRawPtr Class Reference

#include <navtrianglerawptr.h>

Class Description

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

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

Never store a NavTriangleRawPtr for use in subsequent frames, because it has no protection against data streaming. Use NavTrianglePtr 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 NavTrianglePtr which is safer.

+ Examples:

Public Member Functions

 NavTriangleRawPtr ()
 
 NavTriangleRawPtr (const NavFloorRawPtr &navFloorRawPtr, NavTriangleIdx triangleIdx)
 
 NavTriangleRawPtr (NavFloor *navFloor, NavTriangleIdx triangleIdx)
 
NavTriangleIdx GetTriangleIdx () const
 
void Invalidate ()
 
bool IsValid () const
 
bool operator!= (const NavTriangleRawPtr &rhs) const
 
bool operator== (const NavTriangleRawPtr &rhs) const
 
void Set (const NavFloorRawPtr &navFloorRawPtr, NavTriangleIdx triangleIdx)
 
void Set (NavFloor *navFloor, NavTriangleIdx triangleIdx)
 

Public Attributes

NavFloorRawPtr m_navFloorRawPtr
 
CompactNavTriangleIdx m_triangleIdx
 

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 GetVerticesPos3f (Vec3f &v0Pos3f, Vec3f &v1Pos3f, Vec3f &v2Pos3f) const
 
void GetVerticesPos3f (Triangle3f &triangle3f) const
 
void GetVerticesCoordPos64 (CoordPos64 &v0CoordPos64, CoordPos64 &v1CoordPos64, CoordPos64 &v2CoordPos64) const
 
void GetVerticesCoordPos (CoordPos &v0CoordPos, CoordPos &v1CoordPos, CoordPos &v2CoordPos) const
 
KyFloat32 GetAltitudeOfPointInTriangle (const Vec3f &pos) const
 
template<class TraverseLogic >
bool CanBeTraversed (void *traverseLogicUserData, KyFloat32 *costMultiplier=0) const
 

For internal use only

template<class TraverseLogic >
bool CanBeTraversed (void *traverseLogicUserData, KyFloat32 *costMultiplier, const LogicWithoutCostMultipler &) const
 
template<class TraverseLogic >
bool CanBeTraversed (void *traverseLogicUserData, KyFloat32 *costMultiplier, const LogicWithCostMultiplerPerNavTag &) const
 
template<class TraverseLogic >
bool CanBeTraversed (void *traverseLogicUserData, KyFloat32 *costMultiplier, const LogicWithCostMultiplerPerTriangle &) const
 

Constructor & Destructor Documentation

Kaim::NavTriangleRawPtr::NavTriangleRawPtr ( )
inline

Creates an invalid NavTriangleRawPtr.

Kaim::NavTriangleRawPtr::NavTriangleRawPtr ( const NavFloorRawPtr navFloorRawPtr,
NavTriangleIdx  triangleIdx 
)
inline

Constructs a new NavTriangleRawPtr referring to the provided NavTriangleIdx in the provided NavFloorRawPtr.

Parameters
navFloorRawPtrThe NavFloor that contains the triangle this object should refer to.
triangleIdxThe index of this triangle within the NavFloor.
Kaim::NavTriangleRawPtr::NavTriangleRawPtr ( NavFloor navFloor,
NavTriangleIdx  triangleIdx 
)
inline

Constructs a new NavTriangleRawPtr referring to the provided NavTriangleIdx in the provided NavFloor.

Parameters
navFloorThe NavFloor that contains the triangle this object should refer to.
triangleIdxThe index of this triangle within the NavFloor.

Member Function Documentation

KyFloat32 Kaim::NavTriangleRawPtr::GetAltitudeOfPointInTriangle ( const Vec3f pos) const

Returns the altitude of the point on the plane defined by this triangle that has the same (X,Y) coordinates as the specified position.

Parameters
posThe 3D position of the point
Precondition
This object must be valid. Its validity is not checked.
const CellPos & Kaim::NavTriangleRawPtr::GetCellPos ( ) const
inline

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

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

Returns a reference to the NavFloor that contains this triangle.

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

Returns a reference to the NavFloorBlob that contains this triangle.

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

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

Precondition
This object must be valid. Its validity is not checked.
NavTriangleIdx Kaim::NavTriangleRawPtr::GetTriangleIdx ( ) const
inline

Retrieves the index of this triangle within its NavFloorBlob.

+ Examples:
void Kaim::NavTriangleRawPtr::GetVerticesCoordPos ( CoordPos v0CoordPos,
CoordPos v1CoordPos,
CoordPos v2CoordPos 
) const

Updates the parameters to identify the vertices in this triangle.

Parameters
[out]v0CoordPosThe 2D integer position in cell of the first vertex in the triangle.
[out]v1CoordPosThe 2D integer position in cell of the second vertex in the triangle.
[out]v2CoordPosThe 2D integer position in cell of the third vertex in the triangle.
Precondition
This object must be valid. Its validity is not checked.
void Kaim::NavTriangleRawPtr::GetVerticesCoordPos64 ( CoordPos64 v0CoordPos64,
CoordPos64 v1CoordPos64,
CoordPos64 v2CoordPos64 
) const

Updates the parameters to identify the vertices in this triangle.

Parameters
[out]v0CoordPos64The 2D integer position of the first vertex in the triangle.
[out]v1CoordPos64The 2D integer position of the second vertex in the triangle.
[out]v2CoordPos64The 2D integer position of the third vertex in the triangle.
Precondition
This object must be valid. Its validity is not checked.
void Kaim::NavTriangleRawPtr::GetVerticesPos3f ( Vec3f v0Pos3f,
Vec3f v1Pos3f,
Vec3f v2Pos3f 
) const

Updates the parameters to identify the vertices in this triangle.

Parameters
[out]v0Pos3fThe 3D position of the first vertex in the triangle.
[out]v1Pos3fThe 3D position of the second vertex in the triangle.
[out]v2Pos3fThe 3D position of the third vertex in the triangle.
Precondition
This object must be valid. Its validity is not checked.
+ Examples:
void Kaim::NavTriangleRawPtr::GetVerticesPos3f ( Triangle3f triangle3f) const
inline

Updates the parameters to identify the vertices in this triangle.

Parameters
[out]triangle3fThe 3 3D positions of the vertices in the triangle.
Precondition
This object must be valid. Its validity is not checked.
void Kaim::NavTriangleRawPtr::Invalidate ( )
inline

Invalidates this object.

bool Kaim::NavTriangleRawPtr::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::NavTriangleRawPtr::operator!= ( const NavTriangleRawPtr rhs) const
inline

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

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

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

void Kaim::NavTriangleRawPtr::Set ( const NavFloorRawPtr navFloorRawPtr,
NavTriangleIdx  triangleIdx 
)
inline

Clears all information maintained by this object.

Parameters
navFloorRawPtrThe NavFloor that contains the triangle this object should refer to.
triangleIdxThe index of this triangle within the NavFloor.
void Kaim::NavTriangleRawPtr::Set ( NavFloor navFloor,
NavTriangleIdx  triangleIdx 
)
inline

Clears all information maintained by this object.

Parameters
navFloorThe NavFloor that contains the triangle this object should refer to.
triangleIdxThe index of this triangle within the NavFloor.

Member Data Documentation

NavFloorRawPtr Kaim::NavTriangleRawPtr::m_navFloorRawPtr

The NavFloor that contains this triangle.

+ Examples:
CompactNavTriangleIdx Kaim::NavTriangleRawPtr::m_triangleIdx

The index of this triangle within its NavFloor.


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