gwnavruntime/database/databasegenmetrics.h Source File

databasegenmetrics.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: JUBA - secondary contact: NOBODY
8 #ifndef Navigation_DatabaseGenMetrics_H
9 #define Navigation_DatabaseGenMetrics_H
10 
16 
17 namespace Kaim
18 {
19 
23 class DatabaseGenMetrics
24 {
25  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
27 public:
30 
31  // Clears all information maintained by this object. For internal use.
32  void Clear();
33  bool IsClear() const;
34 
35  // ---------------------------------- Public Member Functions ----------------------------------
36 
37  KyFloat32 GetCellSize() const;
41  KyFloat32 GetPixelSize() const;
42 
44  KyFloat32 GetFloatValueFromInteger64(KyInt64 inputValue) const;
45  KyFloat32 GetFloatValueFromInteger32(KyInt32 inputValue) const;
46 
47  CoordPos64 ComputeCellOrigin(const CellPos& cellPos) const;
48 
49  // ---------------------------------- Functions to compute CellPos ----------------------------------
50 
52  CellPos ComputeCellPos(const Vec2f& pos) const;
53 
57  void ComputeCellPos(const Vec2f& pos, CellPos& cellPos) const;
58 
60  CellPos ComputeCellPos(const Vec3f& pos) const;
61 
65  void ComputeCellPos(const Vec3f& pos, CellPos& cellPos) const;
66 
68  CellPos ComputeCellPosFromCoordPos64(const CoordPos64& coordPos64) const;
69 
73  void ComputeCellPosFromCoordPos64(const CoordPos64& coordPos64, CellPos& cellPos) const;
74 
75  // ---------------------------------- Conversion from floating-point coordinates to 64 bits integer coordinates ----------------------------------
76 
77  CoordPos64 GetCoordPos64FromVec3f(const Vec3f& inputPosition) const;
78  void GetCoordPos64FromVec3f(const Vec3f& inputPosition, CoordPos64& result) const;
79 
80  CoordPos64 GetCoordPos64FromVec2f(const Vec2f& inputPosition) const;
81  void GetCoordPos64FromVec2f(const Vec2f& inputPosition, CoordPos64& result) const;
82 
83  // ---------------------------------- Conversion from 64 bits integer coordinates to floating-point coordinates ----------------------------------
84 
85  Vec2f GetVec2fFromCoordPos64(const CoordPos64& inputPosition) const;
86  void GetVec2fFromCoordPos64(const CoordPos64& inputPosition, Vec2f& result) const;
87 
88  // ---------------------------------- Conversion from floating-point coordinates to WorldIntegerPos coordinates ----------------------------------
89 
90  WorldIntegerPos GetWorldIntegerPosFromVec2f(const Vec2f& inputPosition) const;
91  void GetWorldIntegerPosFromVec2f(const Vec2f& inputPosition, WorldIntegerPos& result) const;
92 
93  WorldIntegerPos GetWorldIntegerPosFromVec3f(const Vec3f& inputPosition) const;
94  void GetWorldIntegerPosFromVec3f(const Vec3f& inputPosition, WorldIntegerPos& result) const;
95 
96  // ---------------------------------- Conversion from WorldIntegerPos coordinates to floating-point coordinates ----------------------------------
97 
98  Vec2f GetVec2fFromWorldIntegerPos(const WorldIntegerPos& inputPosition) const;
99  void GetVec2fFromWorldIntegerPos(const WorldIntegerPos& inputPosition, Vec2f& result) const;
100 
101  // ---------------------------------- CoordPos64 <-> WorldIntegerPos Conversion ----------------------------------
102 
103  WorldIntegerPos GetWorldIntegerPosFromCoordPos64(const CoordPos64& inputPosition) const;
104  void GetWorldIntegerPosFromCoordPos64(const CoordPos64& inputPosition, WorldIntegerPos& result) const;
105 
106  CoordPos64 GetCoordPos64FromWorldIntegerPos(const WorldIntegerPos& inputPosition) const;
107  void GetCoordPos64FromWorldIntegerPos(const WorldIntegerPos& inputPosition, CoordPos64& result) const;
108 
109  // ---------------------------------- CellBox computation ----------------------------------
110 
111  void GetCellBoxOfAnAABBox(const Box2f& aABB , CellBox& cellBox) const;
112  void GetCellBoxOfAnAABBox(const Box3f& aABB , CellBox& cellBox) const;
113  void GetCellBoxOfAnAABBox(const CoordBox64& aABB, CellBox& cellBox) const;
114 
115 public: //internal
116  void SetDefaultValues();
117  KyFloat32 SnapFloatOnIntegerGrid(KyFloat32 inputValue) const;
118  KyInt32 SnapFloatOnPixelGrid(KyFloat32 inputValue) const;
119  KyInt64 ComputeCellPosXFromInteger64(KyInt64 x) const;
120  KyInt64 ComputeCellPosYFromInteger64(KyInt64 y) const;
121 
122 public: // internal
123 
126  void Setup();
127 
128 public: // internal
129 
130  // ---------------------------------- Members to be initialized before calling Setup() ----------------------------------
131 
137 
138  // ---------------------------------- Initialized from other members in Setup() ----------------------------------
139 
143 };
144 
145 }
146 
148 
149 #endif //Navigation_DatabaseGenMetrics_H
150 
CellPos ComputeCellPos(const Vec2f &pos) const
Retrieves the position of theNavCell in the grid that is responsible for the specified (X...
Definition: databasegenmetrics.inl:59
CoordPos64 GetCoordPos64FromVec2f(const Vec2f &inputPosition) const
Retrieves the 64-bit integer coordinates that correspond to the specified floating-point coordinates...
Definition: databasegenmetrics.inl:134
This class represents a two-dimensional axis-aligned bounding box whose dimensions are stored using f...
Definition: box2f.h:19
KyInt64 GetNearestInteger64FromFloatValue(KyFloat32 inputValue) const
Retrieves the 64-bit integer nearest to the specified float.
Definition: databasegenmetrics.inl:65
KyFloat32 m_pixelSize
For internal use. Do not modify. Value set in Setup() based on m_integerPrecision.
Definition: databasegenmetrics.h:192
KyFloat32 m_generationRadius
The radius of the character the NavMeshes in this DatabaseGenMetrics were generated for...
Definition: databasegenmetrics.h:179
KyFloat32 GetGenerationHeight() const
Retrieves the height of the character that the NavMeshes in this Database were generated for...
Definition: databasegenmetrics.inl:36
This class represents a two-dimensional axis-aligned bounding box whose dimensions are stored using 3...
Definition: box2i.h:119
KyFloat32 GetCellSize() const
Retrieves the size (length and width) of theNavCells in this Database.
Definition: databasegenmetrics.inl:34
CoordPos64 GetCoordPos64FromVec3f(const Vec3f &inputPosition) const
Retrieves the 64-bit integer coordinates that correspond to the specified floating-point coordinates...
Definition: databasegenmetrics.inl:128
KyInt32 m_cellSizeInCoord
The number of integer steps in the length and width of each cell. Do not modify. Value set in Setup()...
Definition: databasegenmetrics.h:193
void GetCellBoxOfAnAABBox(const Box2f &aABB, CellBox &cellBox) const
Computes a CellBox from a Box2f.
Definition: databasegenmetrics.inl:177
WorldIntegerPos GetWorldIntegerPosFromVec3f(const Vec3f &inputPosition) const
Retrieves the WorldIntegerPos coordinates that correspond to the specified floating-point coordinates...
Definition: databasegenmetrics.inl:160
CellPos ComputeCellPosFromCoordPos64(const CoordPos64 &coordPos64) const
Retrieves the position of theNavCell in the grid that is responsible for the specified (X...
Definition: databasegenmetrics.inl:99
WorldIntegerPos GetWorldIntegerPosFromCoordPos64(const CoordPos64 &inputPosition) const
Retrieves the integer coordinates that correspond to the specified 64-bit integer coordinates...
Definition: databasegenmetrics.inl:141
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
void Setup()
Initialize m_integerPrecisionInv, m_pixelSize and m_cellSizeInCoord, it has to be called after other ...
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
void Clear()
Clears all information maintained by this object. For internal use.
Definition: databasegenmetrics.inl:18
This class defines a two-dimensional vector whose coordinates are stored using 64-bit integers...
Definition: vec2ll.h:27
Vec2f GetVec2fFromWorldIntegerPos(const WorldIntegerPos &inputPosition) const
Retrieves the floating-point coordinates that correspond to the specified WorldIntegerPos coordinates...
Definition: databasegenmetrics.inl:199
KyFloat32 m_altitudeTolerance
The maximum difference in altitude that may exist between the NavMesh and the original terrain mesh...
Definition: databasegenmetrics.h:181
void SetDefaultValues()
Clears all information maintained by this object. For internal use.
Definition: databasegenmetrics.inl:22
KyFloat32 GetFloatValueFromInteger64(KyInt64 inputValue) const
Retrieves the float nearest to the specified 64-bit integer.
Definition: databasegenmetrics.inl:71
This class represents a three-dimensional axis-aligned bounding box whose dimensions are stored using...
Definition: box3f.h:25
CoordPos64 GetCoordPos64FromWorldIntegerPos(const WorldIntegerPos &inputPosition) const
Retrieves the 64-bit integer coordinates that correspond to the specified WorldIntegerPos coordinates...
Definition: databasegenmetrics.inl:165
This class defines a two-dimensional vector whose coordinates are stored using floating-point numbers...
Definition: vec2f.h:24
KyFloat32 GetGenerationRadius() const
Retrieves the radius of the character that NavMeshes in this Database were generated for...
Definition: databasegenmetrics.inl:35
This class defines a two-dimensional vector whose coordinates are stored using 32-bit integers...
Definition: vec2i.h:26
Definition: gamekitcrowddispersion.h:20
Vec2f GetVec2fFromCoordPos64(const CoordPos64 &inputPosition) const
Retrieves the floating-point coordinates that correspond to the specified 64-bit integer coordinates...
Definition: databasegenmetrics.inl:187
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
KyFloat32 m_integerPrecision
For internal use. Do not modify.
Definition: databasegenmetrics.h:182
CoordPos64 ComputeCellOrigin(const CellPos &cellPos) const
Retrieves the 64-bit integer coordinates that mark the origin point of theNavCell at the specified po...
Definition: databasegenmetrics.inl:115
WorldIntegerPos GetWorldIntegerPosFromVec2f(const Vec2f &inputPosition) const
Retrieves the WorldIntegerPos coordinates that correspond to the specified floating-point coordinates...
Definition: databasegenmetrics.inl:153
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:21
KyFloat32 GetFloatValueFromInteger32(KyInt32 inputValue) const
Retrieves the float nearest to the specified 32-bit integer.
Definition: databasegenmetrics.inl:77
KyFloat32 GetGenerationAltitudeTolerance() const
Retrieves the altitude tolerance parameters that the NavMeshes in this Database were generated with...
Definition: databasegenmetrics.inl:37
KyFloat32 m_integerPrecisionInv
For internal use. Do not modify. Value set in Setup() based on m_integerPrecision.
Definition: databasegenmetrics.h:191
KyFloat32 GetPixelSize() const
Retrieves the size of pixel (raster precision) that the NavMeshes in this Database were generated wit...
Definition: databasegenmetrics.inl:38
KyFloat32 m_generationHeight
The height of the character the NavMeshes in this DatabaseGenMetrics were generated for...
Definition: databasegenmetrics.h:180
__int64 KyInt64
Type used internally to represent a 64-bit integer.
Definition: types.h:37
This class gathers a set of generation parameters of one Database and manages the conversion between ...
Definition: databasegenmetrics.h:24
Each instance of this class also maintains a count of the number of elements (or grid cells) containe...
Definition: box2ll.h:24
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
KyInt32 m_cellSizeInPixel
The number of raster pixels in the length and width of each cell. Do not modify.
Definition: databasegenmetrics.h:183