gwnavruntime/channel/channelcomputerconfig.h Source File

channelcomputerconfig.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 namespace Kaim
13 {
14 
15 class AdvancedChannelComputerConfig
16 {
18 
19 public:
20  AdvancedChannelComputerConfig() { SetDefaults(); }
21 
22  void SetDefaults()
23  {
24  m_turnSamplingAngleDeg = 30.0f;
25  m_channelSmoothingAngleDeg = 30.0f;
26  m_minDistBetweenIntermediaryGates = 0.5f;
27  m_maxDistBetweenIntermediaryGates = 10.f;
28  m_gateCollapseWidth = 0.01f;
29  }
30 
31  bool IsValid()
32  {
33  return (m_turnSamplingAngleDeg > 0.0f)
34  && (m_minDistBetweenIntermediaryGates > 0.0f)
35  && (m_maxDistBetweenIntermediaryGates > m_minDistBetweenIntermediaryGates)
36  && (m_gateCollapseWidth >= 0.0f);
37  }
38 
39  bool operator==(const AdvancedChannelComputerConfig& other) const
40  {
41  return (m_turnSamplingAngleDeg == other.m_turnSamplingAngleDeg )
42  && (m_channelSmoothingAngleDeg == other.m_channelSmoothingAngleDeg )
43  && (m_minDistBetweenIntermediaryGates == other.m_minDistBetweenIntermediaryGates)
44  && (m_maxDistBetweenIntermediaryGates == other.m_maxDistBetweenIntermediaryGates)
45  && (m_gateCollapseWidth == other.m_gateCollapseWidth );
46  }
47 
48  bool operator!=(const AdvancedChannelComputerConfig& other) const { return !operator==(other); }
49 
50 public:
53  KyFloat32 m_turnSamplingAngleDeg;
54 
58  KyFloat32 m_channelSmoothingAngleDeg;
59 
64  KyFloat32 m_minDistBetweenIntermediaryGates;
65 
70  KyFloat32 m_maxDistBetweenIntermediaryGates;
71 
76  KyFloat32 m_gateCollapseWidth;
77 };
78 
79 inline void SwapEndianness(Endianness::Target e, AdvancedChannelComputerConfig& self)
80 {
81  SwapEndianness(e, self.m_turnSamplingAngleDeg);
82  SwapEndianness(e, self.m_channelSmoothingAngleDeg);
83  SwapEndianness(e, self.m_minDistBetweenIntermediaryGates);
84  SwapEndianness(e, self.m_maxDistBetweenIntermediaryGates);
85  SwapEndianness(e, self.m_gateCollapseWidth);
86 }
87 
90 {
92 
93 public:
94  ChannelComputerConfig() { SetDefaults(); }
95 
96  void SetDefaults()
97  {
98  m_channelRadius = 4.0f;
99  m_advancedConfig.SetDefaults();
100  }
101 
102  bool IsValid()
103  {
104  return m_channelRadius > 0.f
105  && m_advancedConfig.IsValid();
106  }
107 
108  bool operator==(const ChannelComputerConfig& other) const
109  {
110  return m_channelRadius == other.m_channelRadius
111  && m_advancedConfig == other.m_advancedConfig;
112  }
113 
114  bool operator!=(const ChannelComputerConfig& other) const { return !operator==(other); }
115 
116 public:
120  AdvancedChannelComputerConfig m_advancedConfig;
121 };
122 
123 inline void SwapEndianness(Endianness::Target e, ChannelComputerConfig& self)
124 {
125  SwapEndianness(e, self.m_channelRadius);
126  SwapEndianness(e, self.m_advancedConfig);
127 }
128 
129 } // namespace Kaim
130 
Class that aggregates parameters that allow to configure the channel computation of a Bot...
Definition: channelcomputerconfig.h:89
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
KyFloat32 m_channelRadius
The distance between the path and the Channel borders.
Definition: channelcomputerconfig.h:119
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
float KyFloat32
float
Definition: types.h:32