renderstack::vec4 Class Reference

simple four component float vector

#include <vec4.hpp>

Public Member Functions

 vec4 (float _x=0, float _y=0, float _z=0, float _w=0)
 vec4 (vec3 const &v3, float _w=0)
vec4 operator+ (vec4 const &v) const
vec4operator+= (vec4 const &v)
vec4 operator- (vec4 const &v) const
vec4operator-= (vec4 const &v)
bool operator== (vec4 const &v) const
vec4 operator* (float f) const
vec4operator*= (float f)
vec4 operator/ (float f) const
vec4operator/= (float f)
vec4 operator- () const
float operator[] (int i) const
float & operator[] (int i)
float length_squared () const
float length () const

Data Fields

float x
float y
float z
float w

Detailed Description

Definition at line 35 of file vec4.hpp.


Constructor & Destructor Documentation

renderstack::vec4::vec4 ( float  _x = 0,
float  _y = 0,
float  _z = 0,
float  _w = 0 
) [inline]

Definition at line 38 of file vec4.hpp.

00039     :   x(_x)
00040     ,   y(_y)
00041     ,   z(_z)
00042     ,   w(_w)
00043     {
00044     }

renderstack::vec4::vec4 ( vec3 const &  v3,
float  _w = 0 
) [inline]

Definition at line 46 of file vec4.hpp.

00047     :   x(v3.x)
00048     ,   y(v3.y)
00049     ,   z(v3.z)
00050     ,   w(_w)
00051     {
00052     }


Member Function Documentation

vec4 renderstack::vec4::operator+ ( vec4 const &  v  )  const [inline]

Definition at line 54 of file vec4.hpp.

00055     {
00056         return vec4(x + v.x, y + v.y, z + v.z, w + v.w);
00057     }

vec4& renderstack::vec4::operator+= ( vec4 const &  v  )  [inline]

Definition at line 59 of file vec4.hpp.

00060     {
00061         x += v.x;
00062         y += v.y;
00063         z += v.z;
00064         w += v.w;
00065         return *this;
00066     }

vec4 renderstack::vec4::operator- ( vec4 const &  v  )  const [inline]

Definition at line 68 of file vec4.hpp.

00069     {
00070         return vec4(x - v.x, y - v.y, z - v.z, w - v.w);
00071     }

vec4& renderstack::vec4::operator-= ( vec4 const &  v  )  [inline]

Definition at line 73 of file vec4.hpp.

00074     {
00075         x -= v.x;
00076         y -= v.y;
00077         z -= v.z;
00078         w -= v.w;
00079         return *this;
00080     }

bool renderstack::vec4::operator== ( vec4 const &  v  )  const [inline]

Definition at line 82 of file vec4.hpp.

00083     {
00084         return 
00085             (x == v.x) && 
00086             (y == v.y) && 
00087             (z == v.z) &&
00088             (w == v.w);
00089     }

vec4 renderstack::vec4::operator* ( float  f  )  const [inline]

Definition at line 90 of file vec4.hpp.

00091     {
00092         return vec4(f * x, f * y, f * z, f * w);
00093     }

vec4& renderstack::vec4::operator*= ( float  f  )  [inline]

Definition at line 95 of file vec4.hpp.

00096     {
00097         x *= f;
00098         y *= f;
00099         z *= f;
00100         w *= f;
00101         return *this;
00102     }

vec4 renderstack::vec4::operator/ ( float  f  )  const [inline]

Definition at line 104 of file vec4.hpp.

00105     {
00106         float inv = 1.0f / f;
00107         return vec4(x * inv, y * inv, z * inv, w * inv);
00108     }

vec4& renderstack::vec4::operator/= ( float  f  )  [inline]

Definition at line 110 of file vec4.hpp.

00111     {
00112         float inv = 1.f / f;
00113         x *= inv;
00114         y *= inv;
00115         z *= inv;
00116         w *= inv;
00117         return *this;
00118     }

vec4 renderstack::vec4::operator- (  )  const [inline]

Definition at line 120 of file vec4.hpp.

00121     {
00122         return vec4(-x, -y, -z, -w);
00123     }

float renderstack::vec4::operator[] ( int  i  )  const [inline]

Definition at line 125 of file vec4.hpp.

00126     {
00127         return (&x)[i];
00128     }

float& renderstack::vec4::operator[] ( int  i  )  [inline]

Definition at line 130 of file vec4.hpp.

00131     {
00132         return (&x)[i];
00133     }

float renderstack::vec4::length_squared (  )  const [inline]

Definition at line 135 of file vec4.hpp.

00135 { return x * x + y * y + z * z + w * w; }

float renderstack::vec4::length (  )  const [inline]

Definition at line 136 of file vec4.hpp.

00136 { return std::sqrt(length_squared()); }


Field Documentation

Definition at line 138 of file vec4.hpp.

Definition at line 139 of file vec4.hpp.

Definition at line 140 of file vec4.hpp.

Definition at line 141 of file vec4.hpp.


The documentation for this class was generated from the following file:
Generated on Sun Apr 11 12:23:12 2010 for RenderStack by  doxygen 1.6.3