40 void Add1OnCoordPosX(
KyInt32 cellSizeInCoord);
41 void Remove1OnCoordPosX(
KyInt32 cellSizeInCoord);
42 void Add1OnCoordPosY(
KyInt32 cellSizeInCoord);
43 void Remove1OnCoordPosY(
KyInt32 cellSizeInCoord);
52 SwapEndianness(e,
self.m_cellPos);
53 SwapEndianness(e,
self.m_coordPosInCell);
58 KY_INLINE WorldIntegerPos::WorldIntegerPos(
const CellPos& cellPos,
const CoordPos& posInCell) : m_cellPos(cellPos), m_coordPosInCell(posInCell) {}
69 m_cellPos.
Set(cellCoordX, cellCoordY);
70 m_coordPosInCell.
Set(coordPosX, coordPosY);
73 KY_INLINE
bool WorldIntegerPos::operator==(
const WorldIntegerPos& rhs)
const {
return m_cellPos == rhs.m_cellPos && m_coordPosInCell == rhs.m_coordPosInCell; }
74 KY_INLINE
bool WorldIntegerPos::operator!=(
const WorldIntegerPos& rhs)
const {
return !operator==(rhs); }
75 KY_INLINE
bool WorldIntegerPos::operator<(
const WorldIntegerPos& rhs)
const {
return m_cellPos != rhs.m_cellPos ? m_cellPos < rhs.m_cellPos : m_coordPosInCell < rhs.m_coordPosInCell; }
76 KY_INLINE
bool WorldIntegerPos::operator>(
const WorldIntegerPos& rhs)
const {
return !operator<(rhs) && operator!=(rhs); }
78 KY_INLINE
void WorldIntegerPos::Add1OnCoordPosX(
KyInt32 cellSizeInCoord)
80 KY_DEBUG_ASSERTN(m_coordPosInCell.x > 0 || m_coordPosInCell.x <= cellSizeInCoord, (
"Invalid Object"));
81 KY_DEBUG_ASSERTN(m_coordPosInCell.y >= 0 || m_coordPosInCell.y < cellSizeInCoord, (
"Invalid Object"));
82 if (m_coordPosInCell.x == cellSizeInCoord)
84 m_coordPosInCell.x = 1;
91 KY_INLINE
void WorldIntegerPos::Remove1OnCoordPosX(
KyInt32 cellSizeInCoord)
93 KY_DEBUG_ASSERTN(m_coordPosInCell.x > 0 || m_coordPosInCell.x <= cellSizeInCoord, (
"Invalid Object"));
94 KY_DEBUG_ASSERTN(m_coordPosInCell.y >= 0 || m_coordPosInCell.y < cellSizeInCoord, (
"Invalid Object"));
95 if (m_coordPosInCell.x == 1)
97 m_coordPosInCell.x = cellSizeInCoord;
101 --m_coordPosInCell.x;
104 KY_INLINE
void WorldIntegerPos::Add1OnCoordPosY(
KyInt32 cellSizeInCoord)
106 KY_DEBUG_ASSERTN(m_coordPosInCell.x > 0 || m_coordPosInCell.x <= cellSizeInCoord, (
"Invalid Object"));
107 KY_DEBUG_ASSERTN(m_coordPosInCell.y >= 0 || m_coordPosInCell.y < cellSizeInCoord, (
"Invalid Object"));
108 if (m_coordPosInCell.y + 1 == cellSizeInCoord)
110 m_coordPosInCell.y = 0;
114 ++m_coordPosInCell.y;
117 KY_INLINE
void WorldIntegerPos::Remove1OnCoordPosY(
KyInt32 cellSizeInCoord)
119 KY_DEBUG_ASSERTN(m_coordPosInCell.x > 0 || m_coordPosInCell.x <= cellSizeInCoord, (
"Invalid Object"));
120 KY_DEBUG_ASSERTN(m_coordPosInCell.y >= 0 || m_coordPosInCell.y < cellSizeInCoord, (
"Invalid Object"));
121 if (m_coordPosInCell.y == 0)
123 m_coordPosInCell.y = cellSizeInCoord - 1;
127 --m_coordPosInCell.y;
Vec2i CellPos
A type that represents the position of a cell within a 2D grid.
Definition: navmeshtypes.h:30
static const KyInt32 InvalidCoord
Represents an invalidCoord object.
Definition: navmeshtypes.h:22
void Set(KyInt32 _x, KyInt32 _y)
Sets x=_x and y=_y.
Definition: vec2i.h:29
void Clear()
Clears all information maintained by this object.
Definition: worldintegerpos.h:60
static const KyInt32 InvalidCellCoord
Represents an invalidCellCoord object.
Definition: navmeshtypes.h:32
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
Vec2i CoordPos
A type that represents the position of a point within the 2D integer grid.
Definition: navmeshtypes.h:20
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
2d vector using KyInt32
Definition: vec2i.h:18
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
std::int32_t KyInt32
int32_t
Definition: types.h:24
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:19
void Set(const CellPos &cellPos, const CoordPos &posInCell)
Sets the coordinates of the vector to match the specified values.
Definition: worldintegerpos.h:66
KyInt32 CellCoord
A type that represents the placement of a cell on one axis of a 2D grid.
Definition: navmeshtypes.h:29