8 #ifndef Navigation_CircleArcSplineComputer_H
9 #define Navigation_CircleArcSplineComputer_H
60 String m_visualDebugPrefix;
62 StringPulledBubbleListDisplayConfig m_rawBubbleListDisplayConfig;
63 StringPulledBubbleListDisplayConfig m_adjustedBubbleListDisplayConfig;
64 StringPulledBubbleListDisplayConfig m_simplifiedBubbleListDisplayConfig;
65 CircleArcSplineSectionDisplayConfig m_circleArcSplineSectionDisplayConfig;
68 Ptr<SplineInputBlobDumpConfig> m_inputBlobDumpConfig;
77 StringPulledEdge m_edge;
82 class SplineInputBlobDumpConfig;
83 class SplineInputBlobDumper;
86 class CircleArcSplineComputer
92 void Initialize(
const SplineComputationConfig& splineConfig,
93 const Vec3f& startPosition,
const ChannelSectionPtr& startSection,
94 const Vec3f& endPosition,
const ChannelSectionPtr& endSection);
97 void ClearInternals();
99 void SetStartConstraint(
const Vec2f& constraint) { m_startConstraint = constraint; }
100 void SetEndConstraint(
const Vec2f& constraint) { m_endConstraint = constraint; }
104 KyUInt32 GetOutputCount()
const {
return m_profileOutputs.GetCount(); }
105 const RadiusProfileCircleArcSplineComputerOutput& GetOutput(
KyUInt32 index)
const {
return m_profileOutputs[index]; }
109 enum NextChannelTurnRangeSearchResult
111 NextChannelTurnFound,
115 enum ChangeTurnBubbleResult
117 TurnBubbleChangeRejected,
118 TurnBubbleChangeAccepted,
119 TurnBubbleChangeIgnored
122 enum NeighborTurnValidationResult
125 ValidNeighborTurn_Small,
126 InvalidNeighborTurn_ContinueSearch,
127 InvalidNeighborTurn_StopSearch
130 enum NeighborTurnArcValidationMode
132 UseIsInTurnRangeForSameSideArcsAndCanGoForOppositeOnes,
142 KyResult ComputeBubbleArray(BubbleArray& bubbleArray);
143 KyResult ComputeStringPulledBubbleList(
const BubbleArray& bubbleArray, StringPulledBubbleList& stringPulledBubbleList);
149 void ComputeOptimalSpline(
const StringPulledBubbleList& stringPulledBubbleList, RadiusProfileCircleArcSplineComputerOutput& output,
const RadiusProfile& radiusProfile);
164 NextChannelTurnRangeSearchResult GetNextChannelTurnRange(
const Channel* channel,
KyUInt32 currentIdx,
KyUInt32 lastIdx,
KyUInt32& nextTurnStartIdx,
KyUInt32& nextTurnEndIdx);
165 KyResult UpdateBubbleMaxRadius(
const Vec3f& center,
const Vec3f& constrainingPosition,
const Vec3f& oppositeCorner,
KyFloat32& maxBubbleRadius)
const;
166 KyResult CapBubblesRadiiAccordinglyToStartAndEndPositions(
const Channel* channel,
KyUInt32 gateIdx,
KyFloat32& leftCornerMaxRadius,
KyFloat32& rightCornerMaxRadius)
const;
167 void AddCornerBubble(
const Vec3f& channelCorner,
KyFloat32 BubbleRadius,
RotationDirection rotationDirection, BubbleArray& bubbleArray);
168 KyResult AddIntermediaryGateBubbles(
const Channel* channel,
KyUInt32 gateIdx, BubbleArray& bubbleArray);
169 KyResult AddNextChannelTurnBubbles(
const Channel* channel,
KyUInt32 nextTurnStartIdx,
KyUInt32 nextTurnEndIdx, BubbleArray& bubbleArray);
172 void EnsureBubbleArrayIsStringPullable(BubbleArray& bubbleArray);
174 void AdjustBubbleRadiusRelativelyToNearbyBubble(
const Bubble* nearbyBubble, Bubble& bubble);
175 void EnsureBubbleArrayIsStringPullable_ForwardPass(BubbleArray& bubbleArray,
const KyUInt32 firstCornerBubbleIdx,
const KyUInt32 lastCornerBubbleIdx);
176 void EnsureBubbleArrayIsStringPullable_BackwardPass(BubbleArray& bubbleArray,
const KyUInt32 firstCornerBubbleIdx,
const KyUInt32 lastCornerBubbleIdx);
193 ChangeTurnBubbleResult ChangeTurnBubble(TurnList& turnList, TurnList::Iterator turnIt,
const Bubble& candidate,
196 KyResult FindNewPrevTurn(TurnList& turnList,
const TurnList::Iterator& turnIt,
const CircleArcSplineTurn& curTurn,
const Bubble& turnBubbleCdt,
197 const RotationDirection rotDir, ScopedDisplayList* displayListPtr, TurnList::Iterator& prevTurnIt, TurnListEdge& incomingEdge,
198 const RadiusProfile& radiusProfile,
KyUInt32 radiusIndexInProfile, Bubble& newStartBubble,
KyUInt32& newStartBubbleRadiusIndexInProfile);
200 KyResult FindNewNextTurn(TurnList& turnList,
const TurnList::Iterator& turnIt,
const CircleArcSplineTurn& curTurn,
const Bubble& turnBubbleCdt,
const TurnListEdge& incomingEdge,
201 const RotationDirection rotDir, ScopedDisplayList* displayListPtr, TurnList::Iterator& nextTurnIt, TurnListEdge& outgoingEdge,
202 const RadiusProfile& radiusProfile,
KyUInt32 radiusIndexInProfile, Bubble& newEndBubble,
KyUInt32& newEndBubbleRadiusIndexInProfile);
204 KyResult TryFirstTurnWithRelaxedStartConstraint(
205 Bubble& newStartBubble,
KyUInt32& newStartBubbleRadiusIndexInProfile,
const CircleArcSplineTurn& curTurn,
206 StringPulledEdge& edge,
const Bubble& turnBubbleCdt,
const RotationDirection rotDir, ScopedDisplayList* displayListPtr,
207 TurnListEdge& incomingEdge, TurnList::Iterator& prevTurnIt, TurnList::Iterator prevTurnCdtIt);
209 KyResult TryLastTurnCandidateWithRelaxedEndConstraint(
210 Bubble& newEndBubble,
KyUInt32& newEndBubbleRadiusIndexInProfile,
const CircleArcSplineTurn& curTurn,
211 StringPulledEdge& edge,
const Bubble& turnBubbleCdt,
const RotationDirection rotDir, ScopedDisplayList* displayListPtr,
212 const TurnListEdge& incomingEdge, TurnListEdge& outgoingEdge, TurnList::Iterator& nextTurnIt, TurnList::Iterator nextTurnCdtIt);
214 NeighborTurnValidationResult ValidatePrevTurnCandidate(
const CircleArcSplineTurn& curTurn,
const Bubble& turnBubbleCdt,
const CircleArcSplineTurn& prevTurnCdtTurn,
215 const RotationDirection rotDir, ScopedDisplayList* displayListPtr, TurnListEdge& incomingEdge,
216 KyFloat32& skippedTurnAngleRadSum, NeighborTurnArcValidationMode neighborTurnArcValidationMode);
218 NeighborTurnValidationResult ValidateNextTurnCandidate(
const CircleArcSplineTurn& curTurn,
const Bubble& turnBubbleCdt,
const CircleArcSplineTurn& nextTurnCdtTurn,
219 const RotationDirection rotDir, ScopedDisplayList* displayListPtr,
const TurnListEdge& incomingEdge, TurnListEdge& outgoingEdge,
220 KyFloat32& skippedTurnAngleRadSum, NeighborTurnArcValidationMode neighborTurnArcValidationMode);
222 bool DoesSegmentRespectDistanceToChannelBorder(
const Channel* channel,
223 const Vec3f& from,
KyUInt32 fromSectionIdx,
const Vec3f& to,
KyUInt32& toSectionIdx)
const;
225 bool DoesCircleArcRespectDistanceToChannelBorder(
const Channel* channel,
const Bubble& circleArcBubble,
226 const Vec3f& from,
KyUInt32 fromSectionIdx,
const Vec3f& to,
KyUInt32 toSectionIdx)
const;
229 bool TestCircleArcCanGoWithSampling(
const Bubble &circleArcBubble,
const Vec3f &from,
const Vec3f &to,
const KyFloat32 circleRadius,
KyUInt32 fromSectionIdx,
230 const Channel* channel,
KyUInt32 toSectionIdx)
const;
234 const TurnList& GetTurnList()
const {
return m_turnList; }
239 enum VerboseMode {Verbose, Silent};
246 void InitializeVisualDebugColor();
247 void InitializeDisplayList(ScopedDisplayList& displayList,
const char* groupName,
const char* listName)
const;
248 void RenderSplineComputationInputs()
const;
249 void RenderBubbleData(
const CircleArcSplineTurn& turn,
const char* groupName)
const;
250 void RenderBubbleArray(
const BubbleArray& bubbleArray)
const;
251 void RenderTurnList(
const TurnList& turnList,
const char* listBaseName,
const StringPulledBubbleListDisplayConfig& displayConfig)
const;
257 void VisualDebugCircleArcSpline(CircleArcSpline& circleArcSpline);
259 #ifdef DBG_CircleArcSplineComputer_PrintStatsOnSmallArcs
260 static void PrintSmallElementsStatistics();
261 #endif // DBG_CircleArcSplineComputer_PrintStatsOnSmallArcs
266 const SplineComputationConfig* m_splineConfig;
267 ChannelSectionPtr m_startSection;
268 ChannelSectionPtr m_endSection;
269 Vec3f m_startPosition;
271 Vec2f m_startConstraint;
272 Vec2f m_endConstraint;
282 KyFloat32 m_maxAngleCosToleranceOnStartAndEndConstraints;
286 TurnList::NodePool m_turnPool;
292 bool m_checkStartConstraintMaxAngle;
293 Vec2f m_startConstraintCWLimit;
294 Vec2f m_startConstraintCCWLimit;
296 bool m_checkEndConstraintMaxAngle;
297 Vec2f m_endConstraintCWLimit;
298 Vec2f m_endConstraintCCWLimit;
301 KyArray<RadiusProfileCircleArcSplineComputerOutput> m_profileOutputs;
304 KyUInt32 m_debug_ChangeTurnBubble_VisualDebugListIdx;
305 String m_debug_RadiusProfileLabel;
308 bool m_isInComputingSpline;
312 CircleArcSplineComputerVisualDebugConfig m_visualDebugConfig;
313 bool m_debug_CheckSplineValidity;
317 KY_INLINE
KyFloat32 CircleArcSplineComputer::GetReducedChannelWidth(
KyFloat32 channelWidth)
const
319 const KyFloat32 reducedChannelWidth = (channelWidth > 2.0f * m_margin) ? (channelWidth - m_margin) : 0.5f * channelWidth;
320 return reducedChannelWidth;
325 #endif // Navigation_CircleArcSplineComputer_H
Class used to configure all VisualDebug components for CircleArcSpline computation.
Definition: circlearcsplinecomputer.h:51
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Class aggregating a CircleArcSpline and the corresponding computation result.
Definition: circlearcsplinecomputer.h:33
#define KY_NULL
Null value.
Definition: types.h:247
This class is a runtime container for Gameware Navigation WorldElements such as NavData, Bots, BoxObstacles, TagVolumes...
Definition: world.h:54
RotationDirection
Defines the 4 possible cases of possibly constrained rotation in the horizontal plane for a given ele...
Definition: rotation.h:20
The class representing a spline compounded of oriented circle arcs and straight line segments...
Definition: circlearcspline.h:29
The spline has not yet been computed.
Definition: circlearcsplinecomputationresult.h:19
This class defines a two-dimensional vector whose coordinates are stored using floating-point numbers...
Definition: vec2f.h:24
Definition: gamekitcrowddispersion.h:20
Class used to compute a CircleArcSpline in a Channel.
Definition: circlearcsplinecomputer.h:89
CircleArcSplineComputationResult
Enumerates the CircleArcSpline computation results.
Definition: circlearcsplinecomputationresult.h:17
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
#define KyUInt32MAXVAL
The maximum value that can be stored in the KyUInt32 variable type.
Definition: types.h:226
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23