10 #ifndef Navigation_ChannelSectionPtr_H
11 #define Navigation_ChannelSectionPtr_H
22 class ChannelSectionPtr
27 ChannelSectionPtr(Ptr<ChannelArray> channelArray,
KyUInt32 channelIdx,
KyUInt32 sectionIdx);
34 KyResult SetFromPositionOnPath(
const PositionOnPath& positionOnPath);
40 KyResult Update(
const Vec3f& prevPos,
const Vec3f& newPos);
46 KyResult Update(
const PositionOnPath& positionOnPath,
const Vec3f& newPos);
50 bool operator==(
const ChannelSectionPtr& other)
const;
51 bool operator!=(
const ChannelSectionPtr& other)
const;
57 bool IsFirstSection()
const;
61 bool IsLastSection()
const;
65 bool IsTriangularLeftTurn()
const;
69 bool IsTriangularRightTurn()
const;
73 bool IsPositionInSection(
const Vec2f& position,
KyUInt32& positionFlags)
const;
75 ChannelArray* GetChannelArray()
const;
79 const Channel* GetChannel()
const;
81 KyUInt32 GetPathNodeIdxOfSectionStartGate()
const;
82 KyUInt32 GetPathNodeIdxOfSectionEndGate()
const;
83 KyUInt32 GetPathNodeIdxOfChannelLastGate()
const;
85 KyUInt32 GetSectionStartGateIdx()
const;
86 KyUInt32 GetSectionEndGateIdx()
const;
87 const Gate& GetSectionStartGate()
const;
88 const Gate& GetSectionEndGate()
const;
93 KyResult SetFromPathNodeIdx(
const Ptr<ChannelArray>& channelArray,
KyUInt32 pathNodeIdx);
96 Ptr<ChannelArray> m_channelArray;
102 KY_INLINE
bool ChannelSectionPtr::IsValid()
const
104 if (m_channelArray !=
KY_NULL && m_channelIdx < m_channelArray->GetChannelCount())
106 const Channel* channel = m_channelArray->GetChannel(m_channelIdx);
107 return channel !=
KY_NULL && m_sectionIdx < channel->GetGateCount() + 1;
113 KY_INLINE
bool ChannelSectionPtr::IsFirstSection()
const {
return m_sectionIdx == 0; }
114 KY_INLINE
bool ChannelSectionPtr::IsLastSection()
const {
return m_sectionIdx == GetChannel()->GetGateCount(); }
116 KY_INLINE
bool ChannelSectionPtr::IsTriangularRightTurn()
const
118 GateType type = GetSectionStartGate().m_type;
122 KY_INLINE
bool ChannelSectionPtr::IsTriangularLeftTurn()
const
124 GateType type = GetSectionStartGate().m_type;
128 KY_INLINE
bool ChannelSectionPtr::IsPositionInSection(
const Vec2f& position,
KyUInt32& positionFlags)
const
130 return GetChannel()->IsPositionInSection(position, m_sectionIdx, positionFlags);
133 KY_INLINE ChannelArray* ChannelSectionPtr::GetChannelArray()
const {
return m_channelArray; }
134 KY_INLINE
KyUInt32 ChannelSectionPtr::GetChannelIdx()
const {
return m_channelIdx; }
135 KY_INLINE
KyUInt32 ChannelSectionPtr::GetSectionIdx()
const {
return m_sectionIdx; }
136 KY_INLINE
const Channel* ChannelSectionPtr::GetChannel()
const {
return m_channelArray->GetChannel(m_channelIdx); }
138 KY_INLINE
KyUInt32 ChannelSectionPtr::GetPathNodeIdxOfSectionStartGate()
const {
return GetChannel()->GetGatePathNodeIdx(GetSectionStartGateIdx()); }
139 KY_INLINE
KyUInt32 ChannelSectionPtr::GetPathNodeIdxOfSectionEndGate()
const {
return GetChannel()->GetGatePathNodeIdx(GetSectionEndGateIdx()); }
140 KY_INLINE
KyUInt32 ChannelSectionPtr::GetPathNodeIdxOfChannelLastGate()
const {
return GetChannel()->GetGatePathNodeIdx(GetChannel()->GetGateCount() -1); }
142 KY_INLINE
KyUInt32 ChannelSectionPtr::GetSectionStartGateIdx()
const {
return GetChannel()->GetSectionStartGateIdx(m_sectionIdx); }
143 KY_INLINE
KyUInt32 ChannelSectionPtr::GetSectionEndGateIdx()
const {
return GetChannel()->GetSectionEndGateIdx(m_sectionIdx); }
144 KY_INLINE
const Gate& ChannelSectionPtr::GetSectionStartGate()
const {
return GetChannel()->GetSectionStartGate(m_sectionIdx); }
145 KY_INLINE
const Gate& ChannelSectionPtr::GetSectionEndGate()
const {
return GetChannel()->GetSectionEndGate(m_sectionIdx); }
147 KY_INLINE
bool ChannelSectionPtr::operator!=(
const ChannelSectionPtr& other)
const {
return !(*
this==other); }
148 KY_INLINE
bool ChannelSectionPtr::operator==(
const ChannelSectionPtr& other)
const
150 return m_channelArray == other.m_channelArray && m_channelIdx == other.m_channelIdx && m_sectionIdx == other.m_sectionIdx;
153 template <
class OSTREAM>
154 inline OSTREAM& operator<<(OSTREAM& os,
const ChannelSectionPtr& channelSectionPtr)
156 os <<
"{" << channelSectionPtr.m_channelIdx <<
", " << channelSectionPtr.m_sectionIdx <<
"}";
162 #endif // Navigation_ChannelSectionPtr_H
Indicates the Gate is the start of a sampled turn to the left (CCW). The next Gate must have either L...
Definition: channel.h:31
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
GateType
Enumerates the different kind of Gates.
Definition: channel.h:23
Indicates the Gate is a sampled left turn intermediary Gate.
Definition: channel.h:32
Indicates the Gate is the start of a sampled turn to the right (CW). The next Gate must have either R...
Definition: channel.h:36
#define KY_NULL
Null value.
Definition: types.h:247
Definition: gamekitcrowddispersion.h:20
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
Indicates the Gate is a sampled right turn intermediary Gate.
Definition: channel.h:37