19 class ChannelSectionPtr
24 ChannelSectionPtr(Ptr<ChannelArray> channelArray,
KyUInt32 channelIdx,
KyUInt32 sectionIdx);
31 KyResult SetFromPositionOnPath(
const PositionOnPath& positionOnPath);
37 KyResult Update(
const Vec3f& prevPos,
const Vec3f& newPos);
43 KyResult Update(
const PositionOnPath& positionOnPath,
const Vec3f& newPos);
47 bool operator==(
const ChannelSectionPtr& other)
const;
48 bool operator!=(
const ChannelSectionPtr& other)
const;
54 bool IsFirstSection()
const;
58 bool IsLastSection()
const;
62 bool IsTriangularLeftTurn()
const;
66 bool IsTriangularRightTurn()
const;
70 bool IsPositionInSection(
const Vec2f& position,
KyUInt32& positionFlags)
const;
72 ChannelArray* GetChannelArray()
const;
76 const Channel* GetChannel()
const;
78 KyUInt32 GetPathNodeIdxOfSectionStartGate()
const;
79 KyUInt32 GetPathNodeIdxOfSectionEndGate()
const;
80 KyUInt32 GetPathNodeIdxOfChannelLastGate()
const;
82 KyUInt32 GetSectionStartGateIdx()
const;
83 KyUInt32 GetSectionEndGateIdx()
const;
84 const Gate& GetSectionStartGate()
const;
85 const Gate& GetSectionEndGate()
const;
90 KyResult SetFromPathNodeIdx(
const Ptr<ChannelArray>& channelArray,
KyUInt32 pathNodeIdx);
93 Ptr<ChannelArray> m_channelArray;
99 KY_INLINE
bool ChannelSectionPtr::IsValid()
const
101 if (m_channelArray !=
nullptr && m_channelIdx < m_channelArray->GetChannelCount())
103 const Channel* channel = m_channelArray->GetChannel(m_channelIdx);
104 return channel !=
nullptr && m_sectionIdx < channel->GetGateCount() + 1;
110 KY_INLINE
bool ChannelSectionPtr::IsFirstSection()
const {
return m_sectionIdx == 0; }
111 KY_INLINE
bool ChannelSectionPtr::IsLastSection()
const {
return m_sectionIdx == GetChannel()->GetGateCount(); }
113 KY_INLINE
bool ChannelSectionPtr::IsTriangularRightTurn()
const
115 GateType type = GetSectionStartGate().m_type;
119 KY_INLINE
bool ChannelSectionPtr::IsTriangularLeftTurn()
const
121 GateType type = GetSectionStartGate().m_type;
125 KY_INLINE
bool ChannelSectionPtr::IsPositionInSection(
const Vec2f& position,
KyUInt32& positionFlags)
const
127 return GetChannel()->IsPositionInSection(position, m_sectionIdx, positionFlags);
130 KY_INLINE ChannelArray* ChannelSectionPtr::GetChannelArray()
const {
return m_channelArray; }
131 KY_INLINE
KyUInt32 ChannelSectionPtr::GetChannelIdx()
const {
return m_channelIdx; }
132 KY_INLINE
KyUInt32 ChannelSectionPtr::GetSectionIdx()
const {
return m_sectionIdx; }
133 KY_INLINE
const Channel* ChannelSectionPtr::GetChannel()
const {
return m_channelArray->GetChannel(m_channelIdx); }
135 KY_INLINE
KyUInt32 ChannelSectionPtr::GetPathNodeIdxOfSectionStartGate()
const {
return GetChannel()->GetGatePathNodeIdx(GetSectionStartGateIdx()); }
136 KY_INLINE
KyUInt32 ChannelSectionPtr::GetPathNodeIdxOfSectionEndGate()
const {
return GetChannel()->GetGatePathNodeIdx(GetSectionEndGateIdx()); }
137 KY_INLINE
KyUInt32 ChannelSectionPtr::GetPathNodeIdxOfChannelLastGate()
const {
return GetChannel()->GetGatePathNodeIdx(GetChannel()->GetGateCount() -1); }
139 KY_INLINE
KyUInt32 ChannelSectionPtr::GetSectionStartGateIdx()
const {
return GetChannel()->GetSectionStartGateIdx(m_sectionIdx); }
140 KY_INLINE
KyUInt32 ChannelSectionPtr::GetSectionEndGateIdx()
const {
return GetChannel()->GetSectionEndGateIdx(m_sectionIdx); }
141 KY_INLINE
const Gate& ChannelSectionPtr::GetSectionStartGate()
const {
return GetChannel()->GetSectionStartGate(m_sectionIdx); }
142 KY_INLINE
const Gate& ChannelSectionPtr::GetSectionEndGate()
const {
return GetChannel()->GetSectionEndGate(m_sectionIdx); }
144 KY_INLINE
bool ChannelSectionPtr::operator!=(
const ChannelSectionPtr& other)
const {
return !(*
this==other); }
145 KY_INLINE
bool ChannelSectionPtr::operator==(
const ChannelSectionPtr& other)
const
147 return m_channelArray == other.m_channelArray && m_channelIdx == other.m_channelIdx && m_sectionIdx == other.m_sectionIdx;
150 template <
class OSTREAM>
151 inline OSTREAM& operator<<(OSTREAM& os,
const ChannelSectionPtr& channelSectionPtr)
153 os <<
"{" << channelSectionPtr.m_channelIdx <<
", " << channelSectionPtr.m_sectionIdx <<
"}";
Indicates the Gate is the start of a sampled turn to the left (CCW). The next Gate must have either L...
Definition: channel.h:28
GateType
Enumerates the different kind of Gates.
Definition: channel.h:20
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
Indicates the Gate is a sampled left turn intermediary Gate.
Definition: channel.h:29
Indicates the Gate is the start of a sampled turn to the right (CW). The next Gate must have either R...
Definition: channel.h:33
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
Indicates the Gate is a sampled right turn intermediary Gate.
Definition: channel.h:34