Vec3< T > Struct Template Reference

Vector type for 3D. More...

#include <vec3.h>


Public Member Functions

 Vec3 ()
 Constructor.
 Vec3 (const T X, const T Y, const T Z)
 Constructor.
 Vec3 (const T A)
 Constructor.
 Vec3 (const Vec3< T > &v)
 Constructor.
operator[] (const int i) const
 operator []
T * operator * ()
 operator *
Vec3< T > operator- () const
 Negate vector.
Vec3< T > & operator= (const Vec3< T > &v)
 Assignment operator.
Vec3< T > & operator+= (const Vec3< T > &v)
 Add and assign operator.
Vec3< T > & operator-= (const Vec3< T > &v)
 Subtract and assign operator.
Vec3< T > & Clamp (const T &low, const T &high)
 Clamp values in vector.
Vec3< T > Cross (const Vec3< T > &v) const
 Cross product.
Dot (const Vec3< T > &v) const
 Dot product.
Norm () const
 Norm of the vector.
Vec3< T > & Normalize ()
 Normalize the vector.

Data Fields

x
y
z


Detailed Description

template<typename T>
struct Vec3< T >

Vector type for 3D.

Vector type for 3D with most of the common operators included.


Constructor & Destructor Documentation

template<typename T>
Vec3< T >::Vec3 (  )  [inline]

Constructor.

Sets the components of the vector to 0.

template<typename T>
Vec3< T >::Vec3 ( const T  X,
const T  Y,
const T  Z 
) [inline]

Constructor.

Sets the components of the vector.

Parameters:
X x-value.
Y y-value.
Z z-value.

template<typename T>
Vec3< T >::Vec3 ( const T  A  )  [inline]

Constructor.

Sets the components of the vector to a scalar.

Parameters:
A value for all components of the vector.

template<typename T>
Vec3< T >::Vec3 ( const Vec3< T > &  v  )  [inline]

Constructor.

Sets the vector to another vector.

Parameters:
v vector to initialize to.


Member Function Documentation

template<typename T>
T Vec3< T >::operator[] ( const int  i  )  const [inline]

operator []

Access the elements of the vector using the [] operator.

Parameters:
i number of component.
Returns:
scalar of type T.

template<typename T>
T* Vec3< T >::operator * (  )  [inline]

operator *

Access the elements of the vecotr as a pointer.

Returns:
pointer to scalar of type T.

template<typename T>
Vec3<T> Vec3< T >::operator- (  )  const [inline]

Negate vector.

Return the vector negated.

Returns:
negated vector.

template<typename T>
Vec3<T>& Vec3< T >::operator= ( const Vec3< T > &  v  )  [inline]

Assignment operator.

Assign a vector to another.

Parameters:
the vector to copy values from.
Returns:
the changed vector.

template<typename T>
Vec3<T>& Vec3< T >::operator+= ( const Vec3< T > &  v  )  [inline]

Add and assign operator.

Add a vector to another.

Parameters:
v vector to add from.
Returns:
the changed vector.

template<typename T>
Vec3<T>& Vec3< T >::operator-= ( const Vec3< T > &  v  )  [inline]

Subtract and assign operator.

Subtract a vector from another.

Parameters:
v vector to subtract from.
Returns:
the changed vector.

template<typename T>
Vec3<T>& Vec3< T >::Clamp ( const T &  low,
const T &  high 
) [inline]

Clamp values in vector.

Clamp the values in the vector between low and high.

Parameters:
low lower limit for values.
high high limit for values.
Returns:
the changed vector.

template<typename T>
Vec3<T> Vec3< T >::Cross ( const Vec3< T > &  v  )  const [inline]

Cross product.

Outer product between two vectors.

Parameters:
v right vector in the cross product.
Returns:
cross product between the vectors.

template<typename T>
T Vec3< T >::Dot ( const Vec3< T > &  v  )  const [inline]

Dot product.

Inner product between two vectors.

Parameters:
v vector to do dot product with.
Returns:
dotproduct between the vectors.

template<typename T>
T Vec3< T >::Norm (  )  const [inline]

Norm of the vector.

Calculate the length of the vector.

Returns:
length of the vector.

template<typename T>
Vec3<T>& Vec3< T >::Normalize (  )  [inline]

Normalize the vector.

Normalize the vector.

Returns:
the normalized vector.


Field Documentation

template<typename T>
T Vec3< T >::x

template<typename T>
T Vec3< T >::y

template<typename T>
T Vec3< T >::z

Component values


The documentation for this struct was generated from the following file:
Generated on Thu May 17 20:28:04 2007 for Ocean View by  doxygen 1.5.2