TrinityCore
Position Struct Reference

#include <Position.h>

Classes

struct  ConstStreamer
 
struct  Streamer
 

Public Member Functions

 Position (float x=0, float y=0, float z=0, float o=0)
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a) const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (Position const &pos)
 
void Relocate (Position const *pos)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Streamer< XY > PositionXYStream ()
 
ConstStreamer< XY > PositionXYStream () const
 
Streamer< XYZ > PositionXYZStream ()
 
ConstStreamer< XYZ > PositionXYZStream () const
 
Streamer< XYZO > PositionXYZOStream ()
 
ConstStreamer< XYZO > PositionXYZOStream () const
 
Streamer< PackedXYZ > PositionPackedXYZStream ()
 
ConstStreamer< PackedXYZ > PositionPackedXYZStream () const
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (Position const &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (Position const *pos) const
 
float GetAngle (Position const &pos) const
 
float GetAngle (float x, float y) const
 
float GetRelativeAngle (Position const *pos) const
 
float GetRelativeAngle (float x, float y) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (Position const *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (Position const &pos, float dist) const
 
bool IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (Position const &center, float xradius, float yradius, float zradius) const
 
bool IsWithinDoubleVerticalCylinder (Position const *center, float radius, float height) const
 
bool HasInArc (float arcangle, Position const *pos, float border=2.0f, Optional< float > orientation=Optional< float >()) const
 
bool HasInLine (Position const *pos, float objSize, float width, Optional< float > orientation=Optional< float >()) const
 
std::string ToString () const
 

Static Public Member Functions

static float NormalizeOrientation (float o)
 

Public Attributes

float m_positionX
 
float m_positionY
 
float m_positionZ
 

Private Attributes

float m_orientation
 

Constructor & Destructor Documentation

◆ Position()

Position::Position ( float  x = 0,
float  y = 0,
float  z = 0,
float  o = 0 
)
inline
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
float m_positionZ
Definition: Position.h:56
static float NormalizeOrientation(float o)
Definition: Position.cpp:196
float m_orientation
Definition: Position.h:59
+ Here is the caller graph for this function:

Member Function Documentation

◆ GetAngle() [1/3]

float Position::GetAngle ( Position const *  pos) const
86 {
87  if (!pos)
88  return 0;
89 
90  return GetAngle(pos->GetPositionX(), pos->GetPositionY());
91 }
float GetAngle(Position const *pos) const
Definition: Position.cpp:85
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAngle() [2/3]

float Position::GetAngle ( Position const &  pos) const
inline
187  {
188  return GetAngle(pos.m_positionX, pos.m_positionY);
189  }
float GetAngle(Position const *pos) const
Definition: Position.cpp:85

◆ GetAngle() [3/3]

float Position::GetAngle ( float  x,
float  y 
) const
95 {
96  float dx = x - GetPositionX();
97  float dy = y - GetPositionY();
98 
99  float ang = std::atan2(dy, dx);
100  ang = (ang >= 0) ? ang : 2 * float(M_PI) + ang;
101  return ang;
102 }
#define M_PI
Definition: Common.h:134
float GetPositionY() const
Definition: Position.h:102
float GetPositionX() const
Definition: Position.h:101
+ Here is the call graph for this function:

◆ GetExactDist() [1/3]

float Position::GetExactDist ( float  x,
float  y,
float  z 
) const
58 {
59  return std::sqrt(GetExactDistSq(x, y, z));
60 }
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:158
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetExactDist() [2/3]

float Position::GetExactDist ( Position const &  pos) const
inline
171  {
172  return std::sqrt(GetExactDistSq(pos));
173  }
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:158

◆ GetExactDist() [3/3]

float Position::GetExactDist ( Position const *  pos) const
63 {
64  return std::sqrt(GetExactDistSq(pos));
65 }
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:158
+ Here is the call graph for this function:

◆ GetExactDist2d() [1/3]

float Position::GetExactDist2d ( const float  x,
const float  y 
) const
48 {
49  return std::sqrt(GetExactDist2dSq(x, y));
50 }
float GetExactDist2dSq(const float x, const float y) const
Definition: Position.h:134
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetExactDist2d() [2/3]

float Position::GetExactDist2d ( Position const &  pos) const
inline
147  {
148  return std::sqrt(GetExactDist2dSq(pos));
149  }
float GetExactDist2dSq(const float x, const float y) const
Definition: Position.h:134

◆ GetExactDist2d() [3/3]

float Position::GetExactDist2d ( Position const *  pos) const
53 {
54  return std::sqrt(GetExactDist2dSq(pos));
55 }
float GetExactDist2dSq(const float x, const float y) const
Definition: Position.h:134
+ Here is the call graph for this function:

◆ GetExactDist2dSq() [1/3]

float Position::GetExactDist2dSq ( const float  x,
const float  y 
) const
inline
135  {
136  float dx = m_positionX - x; float dy = m_positionY - y; return dx*dx + dy*dy;
137  }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
+ Here is the caller graph for this function:

◆ GetExactDist2dSq() [2/3]

float Position::GetExactDist2dSq ( Position const &  pos) const
inline
142  {
143  float dx = m_positionX - pos.m_positionX; float dy = m_positionY - pos.m_positionY; return dx*dx + dy*dy;
144  }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54

◆ GetExactDist2dSq() [3/3]

float Position::GetExactDist2dSq ( Position const *  pos) const
inline
152  {
153  float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; return dx*dx + dy*dy;
154  }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54

◆ GetExactDistSq() [1/3]

float Position::GetExactDistSq ( float  x,
float  y,
float  z 
) const
inline
159  {
160  float dz = m_positionZ - z; return GetExactDist2dSq(x, y) + dz*dz;
161  }
float m_positionZ
Definition: Position.h:56
float GetExactDist2dSq(const float x, const float y) const
Definition: Position.h:134
+ Here is the caller graph for this function:

◆ GetExactDistSq() [2/3]

float Position::GetExactDistSq ( Position const &  pos) const
inline
166  {
167  float dx = m_positionX - pos.m_positionX; float dy = m_positionY - pos.m_positionY; float dz = m_positionZ - pos.m_positionZ; return dx*dx + dy*dy + dz*dz;
168  }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
float m_positionZ
Definition: Position.h:56

◆ GetExactDistSq() [3/3]

float Position::GetExactDistSq ( Position const *  pos) const
inline
176  {
177  float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; float dz = m_positionZ - pos->m_positionZ; return dx*dx + dy*dy + dz*dz;
178  }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
float m_positionZ
Definition: Position.h:56

◆ GetOrientation()

float Position::GetOrientation ( ) const
inline
104 { return m_orientation; }
float m_orientation
Definition: Position.h:59

◆ GetPosition() [1/4]

void Position::GetPosition ( float &  x,
float &  y 
) const
inline
107  {
108  x = m_positionX; y = m_positionY;
109  }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
+ Here is the caller graph for this function:

◆ GetPosition() [2/4]

void Position::GetPosition ( float &  x,
float &  y,
float &  z 
) const
inline
112  {
113  x = m_positionX; y = m_positionY; z = m_positionZ;
114  }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
float m_positionZ
Definition: Position.h:56

◆ GetPosition() [3/4]

void Position::GetPosition ( float &  x,
float &  y,
float &  z,
float &  o 
) const
inline
117  {
119  }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
float m_positionZ
Definition: Position.h:56
float m_orientation
Definition: Position.h:59

◆ GetPosition() [4/4]

Position Position::GetPosition ( ) const
inline
121 { return *this; }
+ Here is the caller graph for this function:

◆ GetPositionOffsetTo()

void Position::GetPositionOffsetTo ( Position const &  endPos,
Position retOffset 
) const
68 {
69  float dx = endPos.GetPositionX() - GetPositionX();
70  float dy = endPos.GetPositionY() - GetPositionY();
71 
72  retOffset.m_positionX = dx * std::cos(GetOrientation()) + dy * std::sin(GetOrientation());
73  retOffset.m_positionY = dy * std::cos(GetOrientation()) - dx * std::sin(GetOrientation());
74  retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ();
75  retOffset.SetOrientation(endPos.GetOrientation() - GetOrientation());
76 }
float m_positionY
Definition: Position.h:55
void SetOrientation(float orientation)
Definition: Position.h:96
float GetOrientation() const
Definition: Position.h:104
float m_positionX
Definition: Position.h:54
float GetPositionY() const
Definition: Position.h:102
float m_positionZ
Definition: Position.h:56
float GetPositionZ() const
Definition: Position.h:103
float GetPositionX() const
Definition: Position.h:101
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPositionWithOffset()

Position Position::GetPositionWithOffset ( Position const &  offset) const
79 {
80  Position ret(*this);
81  ret.RelocateOffset(offset);
82  return ret;
83 }
Definition: Position.h:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPositionX()

float Position::GetPositionX ( ) const
inline
101 { return m_positionX; }
float m_positionX
Definition: Position.h:54

◆ GetPositionY()

float Position::GetPositionY ( ) const
inline
102 { return m_positionY; }
float m_positionY
Definition: Position.h:55

◆ GetPositionZ()

float Position::GetPositionZ ( ) const
inline
103 { return m_positionZ; }
float m_positionZ
Definition: Position.h:56

◆ GetRelativeAngle() [1/2]

float Position::GetRelativeAngle ( Position const *  pos) const
inline
192  {
193  return GetAngle(pos) - m_orientation;
194  }
float GetAngle(Position const *pos) const
Definition: Position.cpp:85
float m_orientation
Definition: Position.h:59
+ Here is the caller graph for this function:

◆ GetRelativeAngle() [2/2]

float Position::GetRelativeAngle ( float  x,
float  y 
) const
inline
196 { return GetAngle(x, y) - m_orientation; }
float GetAngle(Position const *pos) const
Definition: Position.cpp:85
float m_orientation
Definition: Position.h:59

◆ GetSinCos()

void Position::GetSinCos ( float  x,
float  y,
float &  vsin,
float &  vcos 
) const
105 {
106  float dx = GetPositionX() - x;
107  float dy = GetPositionY() - y;
108 
109  if (std::fabs(dx) < 0.001f && std::fabs(dy) < 0.001f)
110  {
111  float angle = (float)rand_norm()*static_cast<float>(2 * M_PI);
112  vcos = std::cos(angle);
113  vsin = std::sin(angle);
114  }
115  else
116  {
117  float dist = std::sqrt((dx*dx) + (dy*dy));
118  vcos = dx / dist;
119  vsin = dy / dist;
120  }
121 }
double rand_norm()
Definition: Random.cpp:78
#define M_PI
Definition: Common.h:134
float GetPositionY() const
Definition: Position.h:102
float GetPositionX() const
Definition: Position.h:101
+ Here is the call graph for this function:

◆ HasInArc()

bool Position::HasInArc ( float  arcangle,
Position const *  pos,
float  border = 2.0f,
Optional< float >  orientation = Optional<float>() 
) const
158 {
159  // always have self in arc
160  if (obj == this)
161  return true;
162 
163  // move arc to range 0.. 2*pi
164  arc = NormalizeOrientation(arc);
165 
166  float angle = GetAngle(obj);
167  angle -= orientation.is_initialized() ? *orientation : GetOrientation();
168 
169  // move angle to range -pi ... +pi
170  angle = NormalizeOrientation(angle);
171  if (angle > float(M_PI))
172  angle -= 2.0f * float(M_PI);
173 
174  float lborder = -1 * (arc / border); // in range -pi..0
175  float rborder = (arc / border); // in range 0..pi
176  return ((angle >= lborder) && (angle <= rborder));
177 }
float GetAngle(Position const *pos) const
Definition: Position.cpp:85
float GetOrientation() const
Definition: Position.h:104
#define M_PI
Definition: Common.h:134
static float NormalizeOrientation(float o)
Definition: Position.cpp:196
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasInLine()

bool Position::HasInLine ( Position const *  pos,
float  objSize,
float  width,
Optional< float >  orientation = Optional<float>() 
) const
180 {
181  if (!HasInArc(float(M_PI), pos, 2.0f, orientation))
182  return false;
183 
184  width += objSize;
185  float angle = GetAngle(pos) - (orientation.is_initialized() ? *orientation : GetOrientation());
186  return std::fabs(std::sin(angle)) * GetExactDist2d(pos->GetPositionX(), pos->GetPositionY()) < width;
187 }
float GetAngle(Position const *pos) const
Definition: Position.cpp:85
bool HasInArc(float arcangle, Position const *pos, float border=2.0f, Optional< float > orientation=Optional< float >()) const
Definition: Position.cpp:157
float GetOrientation() const
Definition: Position.h:104
#define M_PI
Definition: Common.h:134
float GetExactDist2d(const float x, const float y) const
Definition: Position.cpp:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsInDist() [1/3]

bool Position::IsInDist ( float  x,
float  y,
float  z,
float  dist 
) const
inline
209 { return GetExactDistSq(x, y, z) < dist * dist; }
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:158
+ Here is the caller graph for this function:

◆ IsInDist() [2/3]

bool Position::IsInDist ( Position const &  pos,
float  dist 
) const
inline
210 { return GetExactDistSq(pos) < dist * dist; }
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:158

◆ IsInDist() [3/3]

bool Position::IsInDist ( Position const *  pos,
float  dist 
) const
inline
211 { return GetExactDistSq(pos) < dist * dist; }
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:158
+ Here is the call graph for this function:

◆ IsInDist2d() [1/2]

bool Position::IsInDist2d ( float  x,
float  y,
float  dist 
) const
inline
200  {
201  return GetExactDist2dSq(x, y) < dist * dist;
202  }
float GetExactDist2dSq(const float x, const float y) const
Definition: Position.h:134
+ Here is the caller graph for this function:

◆ IsInDist2d() [2/2]

bool Position::IsInDist2d ( Position const *  pos,
float  dist 
) const
inline
205  {
206  return GetExactDist2dSq(pos) < dist * dist;
207  }
float GetExactDist2dSq(const float x, const float y) const
Definition: Position.h:134

◆ IsPositionValid()

bool Position::IsPositionValid ( ) const
43 {
45 }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
bool IsValidMapCoord(float c)
Definition: GridDefines.h:220
float m_positionZ
Definition: Position.h:56
float m_orientation
Definition: Position.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsWithinBox()

bool Position::IsWithinBox ( Position const &  center,
float  xradius,
float  yradius,
float  zradius 
) const
124 {
125  // rotate the WorldObject position instead of rotating the whole cube, that way we can make a simplified
126  // is-in-cube check and we have to calculate only one point instead of 4
127 
128  // 2PI = 360*, keep in mind that ingame orientation is counter-clockwise
129  double rotation = 2 * M_PI - center.GetOrientation();
130  double sinVal = std::sin(rotation);
131  double cosVal = std::cos(rotation);
132 
133  float BoxDistX = GetPositionX() - center.GetPositionX();
134  float BoxDistY = GetPositionY() - center.GetPositionY();
135 
136  float rotX = float(center.GetPositionX() + BoxDistX * cosVal - BoxDistY*sinVal);
137  float rotY = float(center.GetPositionY() + BoxDistY * cosVal + BoxDistX*sinVal);
138 
139  // box edges are parallel to coordiante axis, so we can treat every dimension independently :D
140  float dz = GetPositionZ() - center.GetPositionZ();
141  float dx = rotX - center.GetPositionX();
142  float dy = rotY - center.GetPositionY();
143  if ((std::fabs(dx) > xradius) ||
144  (std::fabs(dy) > yradius) ||
145  (std::fabs(dz) > zradius))
146  return false;
147 
148  return true;
149 }
#define M_PI
Definition: Common.h:134
float GetPositionY() const
Definition: Position.h:102
float GetPositionZ() const
Definition: Position.h:103
float GetPositionX() const
Definition: Position.h:101
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsWithinDoubleVerticalCylinder()

bool Position::IsWithinDoubleVerticalCylinder ( Position const *  center,
float  radius,
float  height 
) const
152 {
153  float verticalDelta = GetPositionZ() - center->GetPositionZ();
154  return IsInDist2d(center, radius) && std::abs(verticalDelta) <= height;
155 }
bool IsInDist2d(float x, float y, float dist) const
Definition: Position.h:199
float GetPositionZ() const
Definition: Position.h:103
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NormalizeOrientation()

float Position::NormalizeOrientation ( float  o)
static
197 {
198  // fmod only supports positive numbers. Thus we have
199  // to emulate negative numbers
200  if (o < 0)
201  {
202  float mod = o *-1;
203  mod = std::fmod(mod, 2.0f * static_cast<float>(M_PI));
204  mod = -mod + 2.0f * static_cast<float>(M_PI);
205  return mod;
206  }
207  return std::fmod(o, 2.0f * static_cast<float>(M_PI));
208 }
#define M_PI
Definition: Common.h:134
+ Here is the caller graph for this function:

◆ operator!=()

bool Position::operator!= ( Position const &  a) const
inline
65  {
66  return !(operator==(a));
67  }
bool operator==(Position const &a) const
Definition: Position.cpp:26
+ Here is the call graph for this function:

◆ operator==()

bool Position::operator== ( Position const &  a) const
27 {
28  return (G3D::fuzzyEq(a.m_positionX, m_positionX) &&
29  G3D::fuzzyEq(a.m_positionY, m_positionY) &&
30  G3D::fuzzyEq(a.m_positionZ, m_positionZ) &&
31  G3D::fuzzyEq(a.m_orientation, m_orientation));
32 }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
float m_positionZ
Definition: Position.h:56
float m_orientation
Definition: Position.h:59

◆ PositionPackedXYZStream() [1/2]

Streamer<PackedXYZ> Position::PositionPackedXYZStream ( )
inline
129 { return Streamer<PackedXYZ>(*this); }

◆ PositionPackedXYZStream() [2/2]

ConstStreamer<PackedXYZ> Position::PositionPackedXYZStream ( ) const
inline
130 { return ConstStreamer<PackedXYZ>(*this); }

◆ PositionXYStream() [1/2]

Streamer<XY> Position::PositionXYStream ( )
inline
123 { return Streamer<XY>(*this); }

◆ PositionXYStream() [2/2]

ConstStreamer<XY> Position::PositionXYStream ( ) const
inline
124 { return ConstStreamer<XY>(*this); }

◆ PositionXYZOStream() [1/2]

Streamer<XYZO> Position::PositionXYZOStream ( )
inline
127 { return Streamer<XYZO>(*this); }
+ Here is the caller graph for this function:

◆ PositionXYZOStream() [2/2]

ConstStreamer<XYZO> Position::PositionXYZOStream ( ) const
inline
128 { return ConstStreamer<XYZO>(*this); }

◆ PositionXYZStream() [1/2]

Streamer<XYZ> Position::PositionXYZStream ( )
inline
125 { return Streamer<XYZ>(*this); }
+ Here is the caller graph for this function:

◆ PositionXYZStream() [2/2]

ConstStreamer<XYZ> Position::PositionXYZStream ( ) const
inline
126 { return ConstStreamer<XYZ>(*this); }

◆ Relocate() [1/5]

void Position::Relocate ( float  x,
float  y 
)
inline
70  {
71  m_positionX = x; m_positionY = y;
72  }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
+ Here is the caller graph for this function:

◆ Relocate() [2/5]

void Position::Relocate ( float  x,
float  y,
float  z 
)
inline
75  {
76  m_positionX = x; m_positionY = y; m_positionZ = z;
77  }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
float m_positionZ
Definition: Position.h:56

◆ Relocate() [3/5]

void Position::Relocate ( float  x,
float  y,
float  z,
float  orientation 
)
inline
80  {
81  m_positionX = x; m_positionY = y; m_positionZ = z; SetOrientation(orientation);
82  }
float m_positionY
Definition: Position.h:55
void SetOrientation(float orientation)
Definition: Position.h:96
float m_positionX
Definition: Position.h:54
float m_positionZ
Definition: Position.h:56

◆ Relocate() [4/5]

void Position::Relocate ( Position const &  pos)
inline
85  {
86  m_positionX = pos.m_positionX; m_positionY = pos.m_positionY; m_positionZ = pos.m_positionZ; SetOrientation(pos.m_orientation);
87  }
float m_positionY
Definition: Position.h:55
void SetOrientation(float orientation)
Definition: Position.h:96
float m_positionX
Definition: Position.h:54
float m_positionZ
Definition: Position.h:56

◆ Relocate() [5/5]

void Position::Relocate ( Position const *  pos)
inline
90  {
91  m_positionX = pos->m_positionX; m_positionY = pos->m_positionY; m_positionZ = pos->m_positionZ; SetOrientation(pos->m_orientation);
92  }
float m_positionY
Definition: Position.h:55
void SetOrientation(float orientation)
Definition: Position.h:96
float m_positionX
Definition: Position.h:54
float m_positionZ
Definition: Position.h:56

◆ RelocateOffset()

void Position::RelocateOffset ( Position const &  offset)
35 {
36  m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + float(M_PI)));
37  m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
38  m_positionZ = GetPositionZ() + offset.GetPositionZ();
39  SetOrientation(GetOrientation() + offset.GetOrientation());
40 }
float m_positionY
Definition: Position.h:55
void SetOrientation(float orientation)
Definition: Position.h:96
float GetOrientation() const
Definition: Position.h:104
float m_positionX
Definition: Position.h:54
#define M_PI
Definition: Common.h:134
float GetPositionY() const
Definition: Position.h:102
float m_positionZ
Definition: Position.h:56
float GetPositionZ() const
Definition: Position.h:103
float GetPositionX() const
Definition: Position.h:101
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetOrientation()

void Position::SetOrientation ( float  orientation)
inline
97  {
98  m_orientation = NormalizeOrientation(orientation);
99  }
static float NormalizeOrientation(float o)
Definition: Position.cpp:196
float m_orientation
Definition: Position.h:59
+ Here is the caller graph for this function:

◆ ToString()

std::string Position::ToString ( ) const
190 {
191  std::stringstream sstr;
192  sstr << "X: " << m_positionX << " Y: " << m_positionY << " Z: " << m_positionZ << " O: " << m_orientation;
193  return sstr.str();
194 }
float m_positionY
Definition: Position.h:55
float m_positionX
Definition: Position.h:54
float m_positionZ
Definition: Position.h:56
float m_orientation
Definition: Position.h:59
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_orientation

float Position::m_orientation
private

◆ m_positionX

float Position::m_positionX

◆ m_positionY

float Position::m_positionY

◆ m_positionZ

float Position::m_positionZ

The documentation for this struct was generated from the following files: