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

A 3D vector. More...

#include <vec3.h>

List of all members.

Public Member Functions

 vec3 ()
 Creates a new, uninitialized vector.
 vec3 (type xi, type yi, type zi)
 Creates a new vector with the given coordinates.
 vec3 (const type v[3])
 Creates a new vector with the given coordinates.
 vec3 (const vec3 &v)
 Creates a new vector as a copy of the given vector.
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.
void operator= (const vec3 &v)
 Assigns the given vector to this vector.
bool operator== (const vec3 &v) const
 Returns true if this vector is equal to the given vector.
bool operator!= (const vec3 &v) const
 Returns true if this vector is different from the given vector.
vec3 operator+ (const vec3 &v) const
 Returns the sum of this vector and of the given vector.
vec3 operator- (const vec3 &v) const
 Returns the difference of this vector and of the given vector.
vec3 operator* (const vec3 &v) const
 Returns the product of this vector and of the given vector.
vec3 operator* (const type scalar) const
 Returns the product of this vector and of the given scalar.
vec3 operator/ (const vec3 &v) const
 Returns the division of this vector and of the given vector.
vec3 operator/ (const type scalar) const
 Returns the division of this vector and of the given scalar.
vec3 operator- () const
 Returns the opposite of this vector.
vec3operator+= (const vec3 &v)
 Adds the given vector to this vector.
vec3operator-= (const vec3 &v)
 Substracts the given vector from this vector.
vec3operator*= (const type scalar)
 Multiplies this vector by the given scalar.
vec3operator/= (const type scalar)
 Divides this vector by the given scalar.
bool operator< (const vec3 &v) const
 Compare first element, then second if equal, then third if equal.
type length () const
 Returns the length of this vector.
type squaredLength () const
 Returns the squared length of this vector.
type dotproduct (const vec3 &v) const
 Returns the dot product of this vector and of the given vector.
vec3 normalize () const
 Returns this vector normalized to unit length.
vec3 normalize (type l) const
 Returns this vector normalized to the given length.
vec3 normalize (type *previousLength) const
 Returns this vector normalized to unit length.
vec3 normalize (type l, type *previousLength)
 Returns this vector normalized to the given length.
vec3 crossProduct (const vec3 &v) const
 Returns he cross product of this vector and of the given vector.
vec2< type > xy () const
 Returns the 2D vector defined by (x,y).
template<class t >
vec3< t > cast () const
 Casts this vector to another base type.

Public Attributes

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

Static Public Attributes

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

Detailed Description

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

A 3D vector.


Constructor & Destructor Documentation

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

Creates a new, uninitialized vector.

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

Creates a new vector with the given coordinates.

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

Creates a new vector with the given coordinates.

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

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


Member Function Documentation

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

Casts this vector to another base type.

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

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

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

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

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

Returns the length of this vector.

template<typename type>
vec3< type > ork::vec3< type >::normalize ( type  l,
type *  previousLength 
) [inline]

Returns this vector normalized to the given length.

Returns also its initial length.

template<typename type>
vec3< type > ork::vec3< type >::normalize ( type *  previousLength  )  const [inline]

Returns this vector normalized to unit length.

Returns also its initial length.

template<typename type>
vec3< type > ork::vec3< type >::normalize ( type  l  )  const [inline]

Returns this vector normalized to the given length.

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

Returns this vector normalized to unit length.

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

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

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

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

template<typename type >
vec3< type > ork::vec3< type >::operator* ( const vec3< 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>
vec3< type > & ork::vec3< type >::operator*= ( const type  scalar  )  [inline]

Multiplies this vector by the given scalar.

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

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

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

Adds the given vector to this vector.

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

Returns the opposite of this vector.

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

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

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

Substracts the given vector from this vector.

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

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

template<typename type >
vec3< type > ork::vec3< type >::operator/ ( const vec3< 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>
vec3< type > & ork::vec3< type >::operator/= ( const type  scalar  )  [inline]

Divides this vector by the given scalar.

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

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

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

Assigns the given vector to this vector.

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

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

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

Returns the coordinate of this vector whose index is given.

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

Returns the coordinate of this vector whose index is given.

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

Returns the squared length of this vector.

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

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


Member Data Documentation

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

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

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

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

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

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

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

x coordinate.

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

x coordinate.

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

z coordinate.

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

The null vector (0,0,0).


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