gwnavruntime/channel/channelcomputerconfig.h Source File

channelcomputerconfig.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 #ifndef Navigation_ChannelComputerConfig_H
8 #define Navigation_ChannelComputerConfig_H
9 
10 
13 
14 
15 namespace Kaim
16 {
17 
18 class AdvancedChannelComputerConfig
19 {
21 
22 public:
23  AdvancedChannelComputerConfig();
24 
25  void SetDefaults();
26 
27  bool IsValid();
28 
29  bool operator==(const AdvancedChannelComputerConfig& other) const;
30  bool operator!=(const AdvancedChannelComputerConfig& other) const;
31 
32 public:
35  KyFloat32 m_turnSamplingAngleDeg;
36 
40  KyFloat32 m_channelSmoothingAngleDeg;
41 
46  KyFloat32 m_minDistBetweenIntermediaryGates;
47 
52  KyFloat32 m_maxDistBetweenIntermediaryGates;
53 
58  KyFloat32 m_gateCollapseWidth;
59 };
60 
61 inline void SwapEndianness(Endianness::Target e, AdvancedChannelComputerConfig& self)
62 {
63  SwapEndianness(e, self.m_turnSamplingAngleDeg);
64  SwapEndianness(e, self.m_channelSmoothingAngleDeg);
65  SwapEndianness(e, self.m_minDistBetweenIntermediaryGates);
66  SwapEndianness(e, self.m_maxDistBetweenIntermediaryGates);
67  SwapEndianness(e, self.m_gateCollapseWidth);
68 }
69 
71 class ChannelComputerConfig
72 {
74 
75 public:
77 
78  void SetDefaults();
79 
80  bool IsValid ();
81 
82  bool operator==(const ChannelComputerConfig& other) const;
83  bool operator!=(const ChannelComputerConfig& other) const;
84 
85 public:
88  KyFloat32 m_channelRadius;
89 
90  AdvancedChannelComputerConfig m_advancedConfig;
91 };
92 
93 inline void SwapEndianness(Endianness::Target e, ChannelComputerConfig& self)
94 {
95  SwapEndianness(e, self.m_channelRadius);
96 }
97 
98 
99 
101 // AdvancedChannelComputerConfig inline implementation.
102 
103 KY_INLINE AdvancedChannelComputerConfig::AdvancedChannelComputerConfig() { SetDefaults(); }
104 
105 KY_INLINE void AdvancedChannelComputerConfig::SetDefaults()
106 {
107  m_turnSamplingAngleDeg = 30.0f;
108  m_channelSmoothingAngleDeg = 30.0f;
109  m_minDistBetweenIntermediaryGates = 0.5f;
110  m_maxDistBetweenIntermediaryGates = 10.f;
111  m_gateCollapseWidth = 0.01f;
112 }
113 
114 KY_INLINE bool AdvancedChannelComputerConfig::IsValid()
115 {
116  return (m_turnSamplingAngleDeg > 0.0f)
117  && (m_minDistBetweenIntermediaryGates > 0.0f)
118  && (m_maxDistBetweenIntermediaryGates > m_minDistBetweenIntermediaryGates)
119  && (m_gateCollapseWidth >= 0.0f);
120 }
121 
122 KY_INLINE bool AdvancedChannelComputerConfig::operator==(const AdvancedChannelComputerConfig& other) const
123 {
124  return (m_turnSamplingAngleDeg == other.m_turnSamplingAngleDeg )
125  && (m_channelSmoothingAngleDeg == other.m_channelSmoothingAngleDeg )
126  && (m_minDistBetweenIntermediaryGates == other.m_minDistBetweenIntermediaryGates)
127  && (m_maxDistBetweenIntermediaryGates == other.m_maxDistBetweenIntermediaryGates)
128  && (m_gateCollapseWidth == other.m_gateCollapseWidth );
129 }
130 
131 KY_INLINE bool AdvancedChannelComputerConfig::operator!=(const AdvancedChannelComputerConfig& other) const { return !operator==(other); }
132 
133 
135 // ChannelComputerConfig inline implementation.
136 
137 KY_INLINE ChannelComputerConfig::ChannelComputerConfig() { SetDefaults(); }
138 
139 KY_INLINE void ChannelComputerConfig::SetDefaults()
140 {
141  m_channelRadius = 4.0f;
142  m_advancedConfig.SetDefaults();
143 }
144 
145 KY_INLINE bool ChannelComputerConfig::IsValid()
146 {
147  return m_channelRadius > 0.f
148  && m_advancedConfig.IsValid();
149 }
150 
151 KY_INLINE bool ChannelComputerConfig::operator==(const ChannelComputerConfig& other) const
152 {
153  return m_channelRadius == other.m_channelRadius
154  && m_advancedConfig == other.m_advancedConfig;
155 }
156 
157 KY_INLINE bool ChannelComputerConfig::operator!=(const ChannelComputerConfig& other) const { return !operator==(other); }
158 
159 } // namespace Kaim
160 
161 #endif // Navigation_ChannelComputerConfig_H
Class that aggregates parameters that allow to configure the channel computation of a Bot...
Definition: channelcomputerconfig.h:76
Collects endianness types and utilities used in the blob serialization framework. ...
Definition: endianness.h:23
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43