gwnavruntime/pathfollower/radiusprofile.h Source File

radiusprofile.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 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 #pragma once
8 
11 
12 
13 namespace Kaim
14 {
15 
16 class RadiusProfileBlob;
17 class RadiusProfileArrayBlob;
18 
19 
27 {
28 public:
29  RadiusProfile() { SetDefaults(); }
30 
31  RadiusProfile(const char* name)
32  : m_name(name)
33  {}
34 
35  RadiusProfile(const RadiusProfile& other)
36  : m_name(other.m_name)
37  , m_radiusArray(other.m_radiusArray)
38  {}
39 
40  ~RadiusProfile() { Clear(); }
41 
42  void SetDefaults();
43 
44  // The new profile should have has many radius has current one.
45  // This function is only used in NavigationLab for simple visualdebug and command
46  void UpdateFromBlob(const RadiusProfileBlob& blob);
47 
48  void Clear() { m_radiusArray.Clear(); }
49  void PushBack(KyFloat32 radius) { m_radiusArray.PushBack(radius); }
50 
51  const char* GetName() const { return m_name.ToCStr(); }
52  KyUInt32 GetCount() const { return m_radiusArray.GetCount(); }
53  KyFloat32 GetRadius(KyUInt32 index) const { return m_radiusArray[index]; }
54 
55  void operator=(const RadiusProfile& other);
56  bool operator==(const RadiusProfile& other) const;
57  bool operator!=(const RadiusProfile& other) const { return !(*this == other); }
58 
59 public: // internal
60  void SortInIncreasingOrder();
61 
62 public:
63  String m_name;
64  KyArrayPOD<KyFloat32> m_radiusArray;
65 };
66 
67 
73 {
74 public:
75  RadiusProfileArray() { SetDefaults(); }
76  ~RadiusProfileArray() { Clear(); }
77 
78  void SetDefaults();
79 
80  // The new profileArray should have has many radius profile arrays with each has many radius has current one.
81  // This function is only used in NavigationLab for simple visualdebug and command
82  void UpdateFromBlob(const RadiusProfileArrayBlob& blob);
83 
84  void PushBack(const RadiusProfile& radiusProfile);
85 
86  KyUInt32 GetCount() const { return m_radiusProfileArray.GetCount(); }
87  const RadiusProfile& GetRadiusProfile(KyUInt32 index) const { return m_radiusProfileArray[index]; }
88  RadiusProfile& GetRadiusProfile(KyUInt32 index) { return m_radiusProfileArray[index]; }
89 
90  bool operator==(const RadiusProfileArray& other) const;
91  bool operator!=(const RadiusProfileArray& other) const { return !(*this == other); }
92 
93 private:
94  void Clear();
95 
96  KyArray<RadiusProfile> m_radiusProfileArray;
97  bool m_userDefinedProfile;
98 };
99 
100 } // namespace Kaim
101 
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
RadiusProfile is an array of preferred radii.
Definition: radiusprofile.h:26
General purpose array for movable objects that require explicit construction/destruction.
Definition: kyarray.h:162
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
CircleArcSpline computer can compute several CircleArcSplines each corresponding to a specific Radius...
Definition: radiusprofile.h:72
float KyFloat32
float
Definition: types.h:32