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

#include <vec3d.h>

Public Member Functions

 Vec3D (float x0=0.0f, float y0=0.0f, float z0=0.0f)
 
 Vec3D (const Vec3D &v)
 
Vec3Doperator= (const Vec3D &v)
 
Vec3D operator+ (const Vec3D &v) const
 
Vec3D operator- (const Vec3D &v) const
 
float operator* (const Vec3D &v) const
 
Vec3D operator* (float d) const
 
Vec3D operator% (const Vec3D &v) const
 
Vec3Doperator+= (const Vec3D &v)
 
Vec3Doperator-= (const Vec3D &v)
 
Vec3Doperator*= (float d)
 
float lengthSquared () const
 
float length () const
 
Vec3Dnormalize ()
 
Vec3D operator~ () const
 
 operator float * ()
 

Public Attributes

float x
 
float y
 
float z
 

Friends

Vec3D operator* (float d, const Vec3D &v)
 
std::istream & operator>> (std::istream &in, Vec3D &v)
 
std::ostream & operator<< (std::ostream &out, const Vec3D &v)
 

Constructor & Destructor Documentation

Vec3D::Vec3D ( float  x0 = 0.0f,
float  y0 = 0.0f,
float  z0 = 0.0f 
)
inline
30 : x(x0), y(y0), z(z0) {}
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28
Vec3D::Vec3D ( const Vec3D v)
inline
32 : x(v.x), y(v.y), z(v.z) {}
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28

Member Function Documentation

float Vec3D::length ( ) const
inline
105  {
106  return std::sqrt(x*x+y*y+z*z);
107  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28

+ Here is the caller graph for this function:

float Vec3D::lengthSquared ( ) const
inline
100  {
101  return x*x+y*y+z*z;
102  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28
Vec3D& Vec3D::normalize ( )
inline
110  {
111  this->operator*= (1.0f/length());
112  return *this;
113  }
float length() const
Definition: vec3d.h:104
Vec3D & operator*=(float d)
Definition: vec3d.h:91

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Vec3D::operator float * ( )
inline
135  {
136  return (float*)this;
137  }
Vec3D Vec3D::operator% ( const Vec3D v) const
inline
70  {
71  Vec3D r(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
72  return r;
73  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28
Definition: vec3d.h:25
float Vec3D::operator* ( const Vec3D v) const
inline
54  {
55  return x*v.x + y*v.y + z*v.z;
56  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28
Vec3D Vec3D::operator* ( float  d) const
inline
59  {
60  Vec3D r(x*d,y*d,z*d);
61  return r;
62  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28
Definition: vec3d.h:25
Vec3D& Vec3D::operator*= ( float  d)
inline
92  {
93  x *= d;
94  y *= d;
95  z *= d;
96  return *this;
97  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28

+ Here is the caller graph for this function:

Vec3D Vec3D::operator+ ( const Vec3D v) const
inline
42  {
43  Vec3D r(x+v.x,y+v.y,z+v.z);
44  return r;
45  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28
Definition: vec3d.h:25
Vec3D& Vec3D::operator+= ( const Vec3D v)
inline
76  {
77  x += v.x;
78  y += v.y;
79  z += v.z;
80  return *this;
81  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28
Vec3D Vec3D::operator- ( const Vec3D v) const
inline
48  {
49  Vec3D r(x-v.x,y-v.y,z-v.z);
50  return r;
51  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28
Definition: vec3d.h:25
Vec3D& Vec3D::operator-= ( const Vec3D v)
inline
84  {
85  x -= v.x;
86  y -= v.y;
87  z -= v.z;
88  return *this;
89  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28
Vec3D& Vec3D::operator= ( const Vec3D v)
inline
34  {
35  x = v.x;
36  y = v.y;
37  z = v.z;
38  return *this;
39  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28
Vec3D Vec3D::operator~ ( ) const
inline
116  {
117  Vec3D r(*this);
118  r.normalize();
119  return r;
120  }
Definition: vec3d.h:25

+ Here is the call graph for this function:

Friends And Related Function Documentation

Vec3D operator* ( float  d,
const Vec3D v 
)
friend
65  {
66  return v * d;
67  }
std::ostream& operator<< ( std::ostream &  out,
const Vec3D v 
)
friend
129  {
130  out << v.x << " " << v.y << " " << v.z;
131  return out;
132  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28
std::istream& operator>> ( std::istream &  in,
Vec3D v 
)
friend
123  {
124  in >> v.x >> v.y >> v.z;
125  return in;
126  }
float x
Definition: vec3d.h:28
float z
Definition: vec3d.h:28
float y
Definition: vec3d.h:28

Member Data Documentation

float Vec3D::x
float Vec3D::y
float Vec3D::z

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