ork::vec4< type > Class Template Reference
[math]

A 4D vector. More...

#include <vec4.h>

List of all members.

Public Member Functions

 vec4 ()
 Creates a new, uninitialized vector.
 vec4 (type xi, type yi, type zi, type wi)
 Creates a new vector with the given coordinates.
 vec4 (const type v[4])
 Creates a new vector with the given coordinates.
 vec4 (const vec4 &v)
 Creates a new vector as a copy of the given vector.
 vec4 (const vec3< type > &v)
 Creates a new vector as a copy of the given vector.
 vec4 (const vec3< type > &v, const type wi)
 Creates a new vector as an extension of a vec3.
type operator[] (const int i) const
 Returns the coordinate of this vector whose index is given.
type & operator[] (const int i)
 Returns the coordinate of this vector whose index is given.
vec4 operator= (const vec4 &v)
 Assigns the given vector to this vector.
bool operator== (const vec4 &v) const
 Returns true if this vector is equal to the given vector.
bool operator!= (const vec4 &v) const
 Returns true if this vector is different from the given vector.
vec4 operator+ (const vec4 &v) const
 Returns the sum of this vector and of the given vector.
vec4 operator- (const vec4 &v) const
 Returns the difference of this vector and of the given vector.
vec4 operator* (const vec4 &v) const
 Returns the product of this vector and of the given vector.
vec4 operator* (const type scalar) const
 Returns the product of this vector and of the given scalar.
vec4 operator/ (const vec4 &v) const
 Returns the division of this vector and of the given vector.
vec4 operator/ (const type scalar) const
 Returns the division of this vector and of the given scalar.
vec4 operator- () const
 Returns the opposite of this vector.
vec4operator+= (const vec4 &v)
 Adds the given vector to this vector.
vec4operator-= (const vec4 &v)
 Substracts the given vector from this vector.
vec4operator*= (const type scalar)
 Multiplies this vector by the given scalar.
vec4operator/= (const type scalar)
 Divides this vector by the given scalar.
bool operator< (const vec4 &v) const
 Compare first element, then second if equal, then third if equal, then fourth if equal.
type dotproduct (const vec3< type > &v) const
 Returns the dot product of this vector and of the given vector.
type dotproduct (const vec4 &v) const
 Returns the dot product of this vector and of the given vector.
vec3< type > xyz () const
 Returns the 3D vector defined by (x,y,z).
vec2< type > xy () const
 Returns the 2D vector defined by (x,y).
template<class t >
vec4< t > cast () const
 Casts this vector to another base type.

Public Attributes

type x
 x coordinate.
type y
 x coordinate.
type z
 z coordinate.
type w
 w coordinate.

Static Public Attributes

static const vec4 ZERO
 The null vector (0,0,0,0).
static const vec4 UNIT_X
 The unit x vector (1,0,0,0).
static const vec4 UNIT_Y
 The unit y vector (0,1,0,0).
static const vec4 UNIT_Z
 The unit z vector (0,0,1,0).
static const vec4 UNIT_W
 The unit w vector (0,0,0,1).

Detailed Description

template<typename type>
class ork::vec4< type >

A 4D vector.


Constructor & Destructor Documentation

template<typename type >
ork::vec4< type >::vec4 (  )  [inline]

Creates a new, uninitialized vector.

template<typename type>
ork::vec4< type >::vec4 ( type  xi,
type  yi,
type  zi,
type  wi 
) [inline]

Creates a new vector with the given coordinates.

template<typename type>
ork::vec4< type >::vec4 ( const type  v[4]  )  [inline]

Creates a new vector with the given coordinates.

template<typename type>
ork::vec4< type >::vec4 ( const vec4< type > &  v  )  [inline]

Creates a new vector as a copy of the given vector.

template<typename type>
ork::vec4< type >::vec4 ( const vec3< type > &  v  )  [inline]

Creates a new vector as a copy of the given vector.

The fourth coordinate is initialized to 1.

template<typename type>
ork::vec4< type >::vec4 ( const vec3< type > &  v,
const type  wi 
) [inline]

Creates a new vector as an extension of a vec3.


Member Function Documentation

template<typename type>
template<class t >
vec4<t> ork::vec4< type >::cast (  )  const [inline]

Casts this vector to another base type.

template<typename type>
type ork::vec4< type >::dotproduct ( const vec4< type > &  v  )  const [inline]

Returns the dot product of this vector and of the given vector.

template<typename type>
type ork::vec4< type >::dotproduct ( const vec3< type > &  v  )  const [inline]

Returns the dot product of this vector and of the given vector.

The given vector is considered as a 4D vector with w = 1.

template<typename type >
bool ork::vec4< type >::operator!= ( const vec4< type > &  v  )  const [inline]

Returns true if this vector is different from the given vector.

template<typename type>
vec4< type > ork::vec4< type >::operator* ( const type  scalar  )  const [inline]

Returns the product of this vector and of the given scalar.

template<typename type >
vec4< type > ork::vec4< type >::operator* ( const vec4< type > &  v  )  const [inline]

Returns the product of this vector and of the given vector.

The product is done component by component.

template<typename type>
vec4< type > & ork::vec4< type >::operator*= ( const type  scalar  )  [inline]

Multiplies this vector by the given scalar.

template<typename type >
vec4< type > ork::vec4< type >::operator+ ( const vec4< type > &  v  )  const [inline]

Returns the sum of this vector and of the given vector.

template<typename type >
vec4< type > & ork::vec4< type >::operator+= ( const vec4< type > &  v  )  [inline]

Adds the given vector to this vector.

template<typename type >
vec4< type > ork::vec4< type >::operator- (  )  const [inline]

Returns the opposite of this vector.

template<typename type >
vec4< type > ork::vec4< type >::operator- ( const vec4< type > &  v  )  const [inline]

Returns the difference of this vector and of the given vector.

template<typename type >
vec4< type > & ork::vec4< type >::operator-= ( const vec4< type > &  v  )  [inline]

Substracts the given vector from this vector.

template<typename type>
vec4< type > ork::vec4< type >::operator/ ( const type  scalar  )  const [inline]

Returns the division of this vector and of the given scalar.

template<typename type >
vec4< type > ork::vec4< type >::operator/ ( const vec4< type > &  v  )  const [inline]

Returns the division of this vector and of the given vector.

The division is done component by component.

template<typename type>
vec4< type > & ork::vec4< type >::operator/= ( const type  scalar  )  [inline]

Divides this vector by the given scalar.

template<typename type >
bool ork::vec4< type >::operator< ( const vec4< type > &  v  )  const [inline]

Compare first element, then second if equal, then third if equal, then fourth if equal.

template<typename type >
vec4< type > ork::vec4< type >::operator= ( const vec4< type > &  v  )  [inline]

Assigns the given vector to this vector.

template<typename type >
bool ork::vec4< type >::operator== ( const vec4< type > &  v  )  const [inline]

Returns true if this vector is equal to the given vector.

template<typename type >
type & ork::vec4< type >::operator[] ( const int  i  )  [inline]

Returns the coordinate of this vector whose index is given.

template<typename type >
type ork::vec4< type >::operator[] ( const int  i  )  const [inline]

Returns the coordinate of this vector whose index is given.

template<typename type >
vec2< type > ork::vec4< type >::xy (  )  const [inline]

Returns the 2D vector defined by (x,y).

template<typename type >
vec3< type > ork::vec4< type >::xyz (  )  const [inline]

Returns the 3D vector defined by (x,y,z).


Member Data Documentation

template<typename type>
const vec4< type > ork::vec4< type >::UNIT_W [inline, static]

The unit w vector (0,0,0,1).

template<typename type>
const vec4< type > ork::vec4< type >::UNIT_X [inline, static]

The unit x vector (1,0,0,0).

template<typename type>
const vec4< type > ork::vec4< type >::UNIT_Y [inline, static]

The unit y vector (0,1,0,0).

template<typename type>
const vec4< type > ork::vec4< type >::UNIT_Z [inline, static]

The unit z vector (0,0,1,0).

template<typename type>
type ork::vec4< type >::w

w coordinate.

template<typename type>
type ork::vec4< type >::x

x coordinate.

template<typename type>
type ork::vec4< type >::y

x coordinate.

template<typename type>
type ork::vec4< type >::z

z coordinate.

template<typename type>
const vec4< type > ork::vec4< type >::ZERO [inline, static]

The null vector (0,0,0,0).


Generated on Mon Oct 18 09:36:08 2010 for ork by  doxygen 1.6.1