TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Vec2D Class Reference

#include <vec3d.h>

Public Member Functions

 Vec2D (float x0=0.0f, float y0=0.0f)
 
 Vec2D (const Vec2D &v)
 
Vec2Doperator= (const Vec2D &v)
 
Vec2D operator+ (const Vec2D &v) const
 
Vec2D operator- (const Vec2D &v) const
 
float operator* (const Vec2D &v) const
 
Vec2D operator* (float d) const
 
Vec2Doperator+= (const Vec2D &v)
 
Vec2Doperator-= (const Vec2D &v)
 
Vec2Doperator*= (float d)
 
float lengthSquared () const
 
float length () const
 
Vec2Dnormalize ()
 
Vec2D operator~ () const
 
 operator float * ()
 

Public Attributes

float x
 
float y
 

Friends

Vec2D operator* (float d, const Vec2D &v)
 
std::istream & operator>> (std::istream &in, Vec2D &v)
 

Constructor & Destructor Documentation

Vec2D::Vec2D ( float  x0 = 0.0f,
float  y0 = 0.0f 
)
inline
146 : x(x0), y(y0) {}
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144
Vec2D::Vec2D ( const Vec2D v)
inline
148 : x(v.x), y(v.y) {}
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144

Member Function Documentation

float Vec2D::length ( ) const
inline
211  {
212  return std::sqrt(x*x+y*y);
213  }
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144

+ Here is the caller graph for this function:

float Vec2D::lengthSquared ( ) const
inline
206  {
207  return x*x+y*y;
208  }
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144
Vec2D& Vec2D::normalize ( )
inline
216  {
217  this->operator*= (1.0f/length());
218  return *this;
219  }
float length() const
Definition: vec3d.h:210
Vec2D & operator*=(float d)
Definition: vec3d.h:198

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Vec2D::operator float * ( )
inline
236  {
237  return (float*)this;
238  }
float Vec2D::operator* ( const Vec2D v) const
inline
169  {
170  return x*v.x + y*v.y;
171  }
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144
Vec2D Vec2D::operator* ( float  d) const
inline
174  {
175  Vec2D r(x*d,y*d);
176  return r;
177  }
Definition: vec3d.h:141
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144
Vec2D& Vec2D::operator*= ( float  d)
inline
199  {
200  x *= d;
201  y *= d;
202  return *this;
203  }
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144

+ Here is the caller graph for this function:

Vec2D Vec2D::operator+ ( const Vec2D v) const
inline
157  {
158  Vec2D r(x+v.x,y+v.y);
159  return r;
160  }
Definition: vec3d.h:141
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144
Vec2D& Vec2D::operator+= ( const Vec2D v)
inline
185  {
186  x += v.x;
187  y += v.y;
188  return *this;
189  }
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144
Vec2D Vec2D::operator- ( const Vec2D v) const
inline
163  {
164  Vec2D r(x-v.x,y-v.y);
165  return r;
166  }
Definition: vec3d.h:141
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144
Vec2D& Vec2D::operator-= ( const Vec2D v)
inline
192  {
193  x -= v.x;
194  y -= v.y;
195  return *this;
196  }
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144
Vec2D& Vec2D::operator= ( const Vec2D v)
inline
150  {
151  x = v.x;
152  y = v.y;
153  return *this;
154  }
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144
Vec2D Vec2D::operator~ ( ) const
inline
222  {
223  Vec2D r(*this);
224  r.normalize();
225  return r;
226  }
Definition: vec3d.h:141

+ Here is the call graph for this function:

Friends And Related Function Documentation

Vec2D operator* ( float  d,
const Vec2D v 
)
friend
180  {
181  return v * d;
182  }
std::istream& operator>> ( std::istream &  in,
Vec2D v 
)
friend
230  {
231  in >> v.x >> v.y;
232  return in;
233  }
float x
Definition: vec3d.h:144
float y
Definition: vec3d.h:144

Member Data Documentation

float Vec2D::x
float Vec2D::y

The documentation for this class was generated from the following file: