gwnavruntime/pathfollower/circlearcspline.h Source File

circlearcspline.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 // primary contact: LAPA - secondary contact: NOBODY
8 #ifndef Navigation_CircleArcSpline_H
9 #define Navigation_CircleArcSpline_H
10 
13 
14 
15 namespace Kaim
16 {
17 
18 
19 enum SplineCutMode
20 {
21  CutSplineAtArcStart,
22  CutSplineAtArcEnd,
23  CutSplineAtArcInnerPosition
24 };
25 
30 {
31 public:
32  CircleArcSpline() {}
33 
34  void Clear();
35  bool IsEmpty() const;
36  KyUInt32 GetSectionCount() const;
37 
39  const CircleArcSplineSection& GetSection(KyUInt32 index) const;
40 
42  const Vec3f& GetStartPosition() const;
43 
45  const Vec3f& GetEndPosition() const;
46 
49 
52 
54  Vec2f ComputeStartTangent() const;
55 
57  Vec2f ComputeEndTangent() const;
58 
59 
60  void Display(const CircleArcSplineSectionDisplayConfig& displayConfig, ScopedDisplayList& displayList_arc, ScopedDisplayList& displayList_extremities,
61  ScopedDisplayList& displayList_sectionIdx, ScopedDisplayList& displayList_radius) const;
62 
63 
64 public: // internal
65 
66  // Cuts tail and head to keep just the spline portion between provided positions.
67  KyResult KeepSplineBetween(
68  const Vec3f& newStartPosition, KyUInt32 newStartArcIndex, SplineCutMode startCutMode, KyUInt32 newStartSectionIdx,
69  const Vec3f& newEndPosition, KyUInt32 newEndArcIndex, SplineCutMode endCutMode, KyUInt32 newEndSectionIdx);
70 
71  void Append(const KyArray<CircleArcSplineSection>& sections);
72  void Reset(const KyArray<CircleArcSplineSection>& sections);
73  void PushBack(const CircleArcSplineSection& sections);
74 
75  const KyArray<CircleArcSplineSection>& GetSectionArray() const { return m_sections; }
76 
77 private:
78  KyResult CutTailAt(const Vec3f& position, KyUInt32 arcIndex, SplineCutMode cutMode, KyUInt32 sectionIdx);
79  KyResult CutHeadAt(const Vec3f& position, KyUInt32 arcIndex, SplineCutMode cutMode, KyUInt32 sectionIdx);
80 
81 public: // internal
83 };
84 
85 KY_INLINE void CircleArcSpline::Clear() { m_sections.Clear(); };
86 KY_INLINE void CircleArcSpline::Reset(const KyArray<CircleArcSplineSection>& sections) { m_sections = sections; }
87 
88 KY_INLINE bool CircleArcSpline::IsEmpty() const { return m_sections.IsEmpty(); }
89 KY_INLINE KyUInt32 CircleArcSpline::GetSectionCount() const { return m_sections.GetCount(); }
90 KY_INLINE const CircleArcSplineSection& CircleArcSpline::GetSection(KyUInt32 index) const { KY_ASSERT(IsEmpty() == false); return m_sections[index]; }
91 KY_INLINE const Vec3f& CircleArcSpline::GetStartPosition() const { KY_ASSERT(IsEmpty() == false); return m_sections[0].GetStartPosition(); }
92 KY_INLINE const Vec3f& CircleArcSpline::GetEndPosition() const { KY_ASSERT(IsEmpty() == false); return m_sections[GetLastSectionIndex()].GetEndPosition(); }
93 KY_INLINE KyUInt32 CircleArcSpline::GetLastSectionIndex() const { KY_ASSERT(IsEmpty() == false); return (m_sections.GetCount() - 1); }
94 KY_INLINE const CircleArcSplineSection& CircleArcSpline::GetLastSection() const { KY_ASSERT(IsEmpty() == false); return m_sections[GetLastSectionIndex()]; }
95 KY_INLINE Vec2f CircleArcSpline::ComputeStartTangent() const { KY_ASSERT(IsEmpty() == false); return m_sections[0].ComputeTangent(GetStartPosition()); }
96 KY_INLINE Vec2f CircleArcSpline::ComputeEndTangent() const { KY_ASSERT(IsEmpty() == false); return m_sections[GetLastSectionIndex()].ComputeTangent(GetEndPosition()); }
97 
98 }
99 
100 #endif // Navigation_CircleArcSpline_H
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
const CircleArcSplineSection & GetSection(KyUInt32 index) const
Definition: circlearcspline.h:98
Vec2f ComputeEndTangent() const
Definition: circlearcspline.h:104
Vec2f ComputeStartTangent() const
Definition: circlearcspline.h:103
KyUInt32 GetLastSectionIndex() const
Definition: circlearcspline.h:101
General purpose array for movable objects that require explicit construction/destruction.
Definition: kyarray.h:118
const Vec3f & GetEndPosition() const
Definition: circlearcspline.h:100
The class representing a spline compounded of oriented circle arcs and straight line segments...
Definition: circlearcspline.h:29
This class defines a two-dimensional vector whose coordinates are stored using floating-point numbers...
Definition: vec2f.h:24
Definition: gamekitcrowddispersion.h:20
const Vec3f & GetStartPosition() const
Definition: circlearcspline.h:99
ScopedDisplayList is used to push text, lines or shapes for rendering in the NavigationLab e...
Definition: displaylist.h:136
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
Class representing either an oriented circle arc or a straight line segment, to be aggregated into a ...
Definition: circlearcsplinesection.h:25
const CircleArcSplineSection & GetLastSection() const
Definition: circlearcspline.h:102
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23