17 class DisplayListManager;
65 bool m_displayChannelIndex;
66 bool m_displaySectionIndex;
67 bool m_displayGateIndex;
68 bool m_displayExtremityPolylines;
69 bool m_displayOutline;
71 bool m_displayPathEdges;
72 bool m_displayPathNodes;
73 bool m_displayGateTypeLabel;
74 bool m_displayGateTypeColor;
75 bool m_displayChannelWidthLeft;
76 bool m_displayChannelWidthRight;
78 Color m_channelIndexColor;
79 Color m_sectionIndexColor;
80 Color m_gateIndexColor;
82 Color m_leftBorderColor;
83 Color m_rightBorderColor;
86 Color m_gateDefaultColor;
87 Color m_gateTypeColor[GATE_TYPE_COUNT];
89 Color m_preChannelPolylineColor;
90 Color m_postChannelPolylineColor;
92 Color m_channelWidthLeftColor;
93 Color m_channelWidthRightColor;
95 static const char* GetGateTypeText(
GateType gateType);
116 , m_rightPos(rightPos)
131 bool IsCollapsed()
const {
return m_leftPos == m_rightPos; }
141 template <
class OSTREAM>
142 inline OSTREAM& operator<<(OSTREAM& os,
const Gate& g)
144 os <<
"[L=" << g.m_leftPos <<
", O=" << g.m_pathPos <<
", R=" << g.m_rightPos;
148 case StartGate : os <<
", type=StartGate]";
break;
149 case EndGate : os <<
", type=EndGate]";
break;
153 case LeftTurnEnd : os <<
", type=LeftTurnEnd]";
break;
157 case RightTurnEnd : os <<
", type=RightTurnEnd]";
break;
160 default: os <<
", !!! wrong gate type (" << g.m_type <<
") !!!]";
break;
165 enum ChannelSide { ChannelLeftSide, ChannelRightSide };
169 class Channel :
public RefCountBase<Channel, MemStat_Channel>
172 Channel() : m_firstPathNodeIdx(0) {}
178 KyUInt32 GetGateCount()
const {
return m_gates.GetCount(); }
179 const Gate& GetGate(
KyUInt32 index)
const {
return m_gates[index]; }
181 const KyArray<Vec2f>& GetPreChannelPolyline()
const {
return m_preChannelPolyline; }
182 const KyArray<Vec2f>& GetPostChannelPolyline()
const {
return m_postChannelPolyline; }
184 KyUInt32 GetSectionCount()
const {
KyUInt32 count = GetGateCount();
return (count ? (count + 1) : 0); }
185 KyUInt32 GetLastSectionIdx()
const {
return m_gates.GetCount(); }
186 KyUInt32 GetSectionStartGateIdx(
KyUInt32 sectionIdx)
const {
return Kaim::Max<KyUInt32>(sectionIdx, 1) - 1; }
187 KyUInt32 GetSectionEndGateIdx(
KyUInt32 sectionIdx)
const {
return Kaim::Min<KyUInt32>(sectionIdx, GetGateCount() - 1); }
188 const Gate& GetSectionStartGate(
KyUInt32 sectionIdx)
const {
return GetGate(GetSectionStartGateIdx(sectionIdx)); }
189 const Gate& GetSectionEndGate(
KyUInt32 sectionIdx)
const {
return GetGate(GetSectionEndGateIdx(sectionIdx)); }
220 bool IsConcaveCorner(
KyUInt32 gateIdx, ChannelSide side)
const;
227 bool IntersectSegmentVsPreChannelPolyline(
const Vec2f& A,
const Vec2f& B,
Vec2f& intersection)
const {
return IntersectSegmentVsPolyline(A, B, m_preChannelPolyline , intersection); }
228 bool IntersectSegmentVsPostChannelPolyline(
const Vec2f& A,
const Vec2f& B, Vec2f& intersection)
const {
return IntersectSegmentVsPolyline(A, B, m_postChannelPolyline, intersection); }
230 void SendVisualDebug(DisplayListManager* displayListManager,
const ChannelDisplayConfig& displayConfig = ChannelDisplayConfig(),
KyUInt32 indexInChannelArray = 0,
const char* listBaseName =
"",
const char* groupName =
"Channel",
KyUInt32 visualDebugId =
KyUInt32MAXVAL)
const;
238 void Initialize() { Clear(); }
240 void AddGate(
const Gate& gate) { m_gates.PushBack(gate); }
241 Gate& GetGate(
KyUInt32 index) {
return m_gates[index]; }
242 void SetPreChannelPolyline(
const KyArray<Vec2f>& polyline) { m_preChannelPolyline = polyline; }
243 void SetPostChannelPolyline(
const KyArray<Vec2f>& polyline) { m_postChannelPolyline = polyline; }
244 void SetPolylineFromBlob(
const BlobArray<Vec2f>& polylineBlob, KyArray<Vec2f>& polyline);
246 void SetFirstPathNodeIdx(
KyUInt32 firstPathNodeIdx) { m_firstPathNodeIdx = firstPathNodeIdx; }
257 bool IsInsidePolyline(
const Vec2f& position,
const KyArray<Vec2f>& polyline)
const;
259 bool IntersectSegmentVsPolyline(
const Vec2f& A,
const Vec2f& B,
const KyArray<Vec2f>& polyline, Vec2f& intersection)
const;
260 bool IsPositionWithinSectionBorders(
const Vec2f& newPos2d,
const Vec2f& A,
const Vec2f& B,
const Vec2f& C,
const Vec2f& D)
const;
263 KyResult ComputeChannelWidth_LeftSideForward(
KyUInt32 gateIdx,
const Vec2f& computedGateLeftPos2d,
const Vec2f& computedGateRightPos2d,
KyFloat32& gateLeftSquareWidth);
264 KyResult ComputeChannelWidth_LeftSideBackward(
KyUInt32 gateIdx,
const Vec2f& computedGateLeftPos2d,
const Vec2f& computedGateRightPos2d,
KyFloat32& gateLeftSquareWidth);
267 KyResult ComputeChannelWidth_RightSideForward(
KyUInt32 gateIdx,
const Vec2f& computedGateLeftPos2d,
const Vec2f& computedGateRightPos2d,
KyFloat32& gateRightSquareWidth);
268 KyResult ComputeChannelWidth_RightSideBackward(
KyUInt32 gateIdx,
const Vec2f& computedGateLeftPos2d,
const Vec2f& computedGateRightPos2d,
KyFloat32& gateRightSquareWidth);
271 KyArray<Gate> m_gates;
272 KyArray<Vec2f> m_preChannelPolyline;
273 KyArray<Vec2f> m_postChannelPolyline;
277 KY_INLINE
void Channel::Clear()
280 m_preChannelPolyline.Clear();
281 m_postChannelPolyline.Clear();
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
Position is outside the section: it lays on the left of the left Border.
Definition: channel.h:54
Class that configures the Channel visual debug display.
Definition: channel.h:59
Indicates the Gate is a right turn end.
Definition: channel.h:35
const Vec3f & GetEndPos() const
Returns the channel end position, i.e.
Definition: channel.h:197
GateType
Enumerates the different kind of Gates.
Definition: channel.h:20
Indicates the Gate is a left turn end.
Definition: channel.h:30
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
Indicates the Gate is a sampled left turn intermediary Gate.
Definition: channel.h:29
KyResult GetSectionFromPositionAndSeed_AlongBubble(const Bubble &bubble, const Kaim::Vec3f &previousPosition, KyUInt32 previousSectionIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newSectionIdx) const
Given a previous position and its section, computes the section for a new position that is supposed t...
Definition: channel.cpp:323
KyUInt32 GetGatePathNodeIdx(KyUInt32 gateIndex) const
Return PathNodeIdx of the gate at gateIndex.
Definition: channel.h:203
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
Indicates the Gate is not defined.
Definition: channel.h:22
General purpose array for movable objects that require explicit construction/destruction.
Definition: kyarray.h:162
bool IsPositionInSection(const Vec2f &position, KyUInt32 sectionIndex, KyUInt32 &positionFlags) const
Checks a provided 2D position is inside a channel section.
Definition: channel.cpp:114
KyResult GetSectionFromPositionAndSeed(const Kaim::Vec3f &previousPosition, KyUInt32 previousSectionIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newSectionIdx) const
Given a previous position and its section, computes the section for a new position that is supposed t...
Definition: channel.cpp:287
Indicates the Gate is a small turn to the left (CCW).
Definition: channel.h:27
Position is outside the section: it lays before the section start Gate.
Definition: channel.h:52
Indicates the Gate is a Channel start Gate.
Definition: channel.h:24
RelativePositionToChannelSectionFlag
Enumerates the Channel::IsPositionInSection relative position flags.
Definition: channel.h:48
This class represents a circle with potential rotation limitation.
Definition: bubble.h:31
2d vector using KyFloat32.
Definition: vec2f.h:18
Position is outside the section: it lays after the section end Gate.
Definition: channel.h:53
Indicates the Gate is a Channel width adjustment Gate. There is no direction modification there...
Definition: channel.h:37
Navigation return code class.
Definition: types.h:108
KyResult InitFromBlob(const ChannelBlob &channelBlob)
These functions are expected to be used internally in Channel computation classes.
Definition: channel.cpp:621
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
const Vec3f & GetStartPos() const
Returns the channel start position, i.e.
Definition: channel.h:193
Channel enrich Path with clearance information on each side of the Path.
Definition: channel.h:169
RGBA color.
Definition: color.h:16
KyUInt32 GetFirstPathNodeIdx() const
Return PathNodeIdx of the first gate.
Definition: channel.h:200
Position is inside the section.
Definition: channel.h:50
Indicates the Gate is a small turn to the right (clockwise).
Definition: channel.h:32
Indicates the Gate is a Channel end Gate.
Definition: channel.h:25
This class represents Channel section limit segment. See Channel class description.
Definition: channel.h:103
void Clear()
Sets x=0.0f, y=0.0f and z=0.0f.
Definition: vec3f.h:34
Indicates the Gate is a Channel altitude clamping adjustment Gate. There is no direction modification...
Definition: channel.h:38
Indicates the Gate is a sampled right turn intermediary Gate.
Definition: channel.h:34
Position is outside the section: it lays on the right of the right Border.
Definition: channel.h:55
#define KyUInt32MAXVAL
KyUInt32 max value
Definition: types.h:68
float KyFloat32
float
Definition: types.h:32
3d vector using 32bits floating points.
Definition: vec3f.h:16