39 bool operator!=(
const PositionOnPath& other)
const {
return !(*
this == other); }
42 void InitOnPathFirstNode(
Path* path) { InitOnPathNode(path, 0); }
43 void InitOnPathLastNode(
Path* path);
44 void InitOnPathEdge(
Path* path,
const Vec3f& positionOnEdge,
KyUInt32 pathEdgeIdx);
48 bool IsValid()
const {
return m_onPathStatus !=
PositionOnPathStatus_Undefined && m_path !=
nullptr && m_currentIndexOnPath < m_path->GetNodeCount(); }
54 bool IsAtLastEdgeOfPath()
const {
return IsAtLastNodeOfPath() || (m_onPathStatus ==
PositionOnPathStatus_OnPathEdge && m_currentIndexOnPath + 1 == m_path->GetEdgeCount()); }
56 bool IsAtLastNodeOfAChannel()
const;
58 Path* GetPath()
const {
return m_path; }
60 const Vec3f& GetPosition()
const {
return m_position; }
64 KyFloat32 GetRemainingDistanceToEndOfPath()
const {
return m_distanceToEndOfPath; }
175 void MoveForwardToNextPathNode_Unsafe();
177 void MoveBackwardToPrevPathNode_Unsafe();
179 void MoveForwardToNextPathEdge_Unsafe();
181 void MoveBackwardToPrevPathEdge_Unsafe();
184 KyFloat32 ComputeDistanceToEndOfPathFromPathEdge(
KyUInt32 pathEdgeIdx,
const Vec3f& positionOnEdge)
const;
188 void ClampOnCurrentPathEdge(
const Kaim::Vec3f& originalPosition);
194 position = m_position;
195 onPathStatus = m_onPathStatus;
196 currentIndexOnPath = m_currentIndexOnPath;
197 distanceToEndOfPath = m_distanceToEndOfPath;
202 m_position = position;
203 m_onPathStatus = onPathStatus;
204 m_currentIndexOnPath = currentIndexOnPath;
205 m_distanceToEndOfPath = distanceToEndOfPath;
216 bool m_mustUpdateDistanceInternalState;
PathEdgeType GetEdgeTypeToMoveOnForward() const
return the type of the edge given by GetEdgeIdxToMoveOnForward()
Definition: positiononpath.h:70
KyUInt32 GetPathEdgeIndex() const
This function has to be used carefully:
Definition: positiononpath.inl:10
KyUInt32 GetEdgeIdxToMoveOnForward() const
If this in on a Path node, it returns the index of the edge starting at this Path node...
Definition: positiononpath.inl:20
This class aggregates all necessary information about a position on a Path.
Definition: positiononpath.h:29
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
void MoveBackwardToPrevPathEdge()
Atomic forward move method: must be used with lot of care.
Definition: positiononpath.inl:74
PositionOnPathStatus
< enumerates="" the="" different="" status="" an="" objectpositiononpath="" can="" have="" on="" its="" path.="" />
Definition: positiononpath.h:17
KyUInt32 GetEdgeIdxToMoveOnBackward() const
If this in on a Path node, it returns the index of the edge ending at this Path node, else it returns the index of the edge current instance lies on.
Definition: positiononpath.h:103
bool IsStrictlyBefore(const PositionOnPath &other) const
Returns true when this PositionOnPath strictly precede the other one; returns false if it as as the s...
Definition: positiononpath.cpp:236
The PositionOnPath is on a Path node.
Definition: positiononpath.h:20
The PositionOnPath is on a Path edge.
Definition: positiononpath.h:21
PathEdgeType GetPathEdgeType() const
This function has to be used carefully, cf. GetPathEdgeIndex()
Definition: positiononpath.h:67
void MoveForward(KyFloat32 distanceMove)
Main distance-based forward move method: moves the position along distanceMove meters measured on the...
Definition: positiononpath.cpp:281
void MoveBackward(KyFloat32 distanceMove)
Main distance-based backward move method: moves the position along distanceMove meters measured on th...
Definition: positiononpath.cpp:304
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
The PositionOnPath is not yet defined.
Definition: positiononpath.h:19
PathEdgeType GetEdgeTypeToMoveOnBackward() const
return the type of the edge given by GetEdgeIdxToMoveOnBackward()
Definition: positiononpath.h:73
void MoveForwardToNextPathNode()
Atomic forward move method: must be used with lot of care.
Definition: positiononpath.inl:56
KyFloat32 MoveForwardToClosestPositionOnPath(const Vec3f &originalPosition, const PositionOnPath *upToPosOnPath=nullptr)
Move forward to the closest position on path from originalPosition.
Definition: positiononpath.cpp:126
KyFloat32 MoveForward_StopAtPathNode_Unsafe(KyFloat32 distanceMove)
These functions are unsafe in regard to the pre-conditions mentioned in the functions of similar name...
Definition: positiononpath.cpp:422
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
KyFloat32 ComputeDistance(const PositionOnPath &otherPositionOnPath) const
Return the distance along the Path from/to the other position.
Definition: positiononpath.cpp:99
KyFloat32 MoveBackward_StopAtPathNode(KyFloat32 distanceMove)
Atomic move method: moves backward the position on the current Path edge it lays on, up to distanceMove meters.
Definition: positiononpath.inl:49
void MoveBackwardToPrevPathNode()
Atomic backward move method: must be used with lot of care.
Definition: positiononpath.inl:62
void MoveForwardToNextPathEdge()
Atomic forward move method: must be used with lot of care.
Definition: positiononpath.inl:68
bool DoesPrecede(const PositionOnPath &other) const
Returns true when this PositionOnPath precede or is at same position that the other one...
Definition: positiononpath.cpp:192
KyFloat32 MoveForward_StopAtPathNode(KyFloat32 distanceMove)
Atomic move method: moves forward the position on the current Path edge it lays on, up to distanceMove meters.
Definition: positiononpath.inl:42
#define KyUInt32MAXVAL
KyUInt32 max value
Definition: types.h:68
The class representing a path.
Definition: path.h:62
float KyFloat32
float
Definition: types.h:32
3d vector using 32bits floating points.
Definition: vec3f.h:16