vector4 Struct Reference

4 component vector More...

#include <3dmath.h>

List of all members.

Public Member Functions

 vector4 (float _x=0, float _y=0, float _z=0, float _w=1)
 Constructor.
 vector4 (const float *v)
 Constructor.
 vector4 (const vector4 &v)
 Copy constructor.
 vector4 (const vector3 &v, float _w)
 Constructor.
vector4operator= (const vector4 &v)
 Assignment operator.
float operator[] (unsigned i) const
 Get component.
vector4 operator* (float f) const
 Scalar multiply operator.
vector4operator*= (float f)
 Multiply assignment operator.
bool operator== (const vector4 &v) const
 Equal operator.
bool operator!= (const vector4 &v) const
 Notequal operator.
wxString ToString () const
 Get string.
vector4Clone () const
 Get copy of instance.

Public Attributes

union {
   struct {
      float   x
 Components.
      float   y
      float   z
      float   w
   } 
   float   _v [4]
 Components.
}; 

Friends

vector4 operator* (float f, const vector4 &v)
 Scalar multiply operator.
std::ostream & operator<< (std::ostream &os, const vector4 &v)
 Output stream operator.


Detailed Description

4 component vector

Definition at line 251 of file 3dmath.h.


Constructor & Destructor Documentation

vector4::vector4 ( float  _x = 0,
float  _y = 0,
float  _z = 0,
float  _w = 1 
) [inline]

Constructor.

Definition at line 265 of file 3dmath.h.

00265 : x(_x), y(_y), z(_z), w(_w)       {}

vector4::vector4 ( const float *  v  )  [inline]

Constructor.

Definition at line 267 of file 3dmath.h.

00267 : x(v[0]), y(v[1]), z(v[2]), w(v[3])      {}

vector4::vector4 ( const vector4 v  )  [inline]

Copy constructor.

Definition at line 269 of file 3dmath.h.

00269 : x(v.x), y(v.y), z(v.z), w(v.w)          {}

vector4::vector4 ( const vector3 v,
float  _w 
) [inline]

Constructor.

Definition at line 271 of file 3dmath.h.

00271 : x(v.x), y(v.y), z(v.z), w(_w)    {}


Member Function Documentation

vector4& vector4::operator= ( const vector4 v  )  [inline]

Assignment operator.

Definition at line 274 of file 3dmath.h.

00275        {
00276               x = v.x;
00277               y = v.y;
00278               z = v.z;
00279               w = v.w;
00280               return *this;
00281        }

float vector4::operator[] ( unsigned  i  )  const [inline]

Get component.

Definition at line 284 of file 3dmath.h.

00285        {
00286               return _v[i];
00287        }

vector4 vector4::operator* ( float  f  )  const [inline]

Scalar multiply operator.

Definition at line 290 of file 3dmath.h.

00291        {
00292               return vector4(f*x, f*y, f*z, f*w);
00293        }

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

Multiply assignment operator.

Definition at line 302 of file 3dmath.h.

00303        {
00304               x *= f;
00305               y *= f;
00306               z *= f;
00307               w *= f;
00308               return *this;
00309        }

bool vector4::operator== ( const vector4 v  )  const [inline]

Equal operator.

Definition at line 312 of file 3dmath.h.

00313        {
00314               return (x == v.x) && ( y == v.y) && (z == v.z) && (w == v.w);
00315        }

bool vector4::operator!= ( const vector4 v  )  const [inline]

Notequal operator.

Definition at line 318 of file 3dmath.h.

00319        {
00320               return (x != v.x) || ( y != v.y) || (z != v.z) || (w != v.w);
00321        }

wxString vector4::ToString (  )  const [inline]

Get string.

Definition at line 324 of file 3dmath.h.

00325        {
00326               return wxString(wxT("(")) << x << wxT(", ") << y << wxT(", ") << z << wxT(", ") << w << wxT(")");
00327        }

vector4* vector4::Clone (  )  const [inline]

Get copy of instance.

Definition at line 336 of file 3dmath.h.

00337        {
00338               return new vector4(*this);
00339        }


Friends And Related Function Documentation

vector4 operator* ( float  f,
const vector4 v 
) [friend]

Scalar multiply operator.

Definition at line 296 of file 3dmath.h.

00297        {
00298               return vector4(f*v.x, f*v.y, f*v.z, f*v.w);
00299        }

std::ostream& operator<< ( std::ostream &  os,
const vector4 v 
) [friend]

Output stream operator.

Definition at line 330 of file 3dmath.h.

00331        {
00332               return os << "(" << v.x << ", " << v.y << ", " << v.z << ", " << v.w << ")";
00333        }


Member Data Documentation

float vector4::x

Components.

Definition at line 258 of file 3dmath.h.

float vector4::y

Definition at line 258 of file 3dmath.h.

float vector4::z

Definition at line 258 of file 3dmath.h.

float vector4::w

Definition at line 258 of file 3dmath.h.

float vector4::_v[4]

Components.

Definition at line 261 of file 3dmath.h.

union { ... }


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

Generated on Tue Mar 10 14:41:39 2009 for VRUT by  doxygen 1.5.5