SourceForge.net Logo

camvox::TVector< T > Class Template Reference

#include <Vector.h>

List of all members.


Detailed Description

template<class T>
class camvox::TVector< T >

A homogenious vector and point class.

A homogenious 3D vector has 4 values: x, y, z, w. The w value can have one of two values; 0.0 means it is a vector, while 1.0 means it is a point.

Both a point and a vector can be multiplied by a 4 x 4 affine Matrix; to be scaled, sheared, rotated and translated (translation only for points). normal 3D points multiplied by a 3 x 3 matrix needed a seperate translation step.

This vector template is compatible with both floating point values and with interval values.

See also:
TMatrix

TInterval


Public Member Functions

 TVector (void)
 Construct a zero vector.
 TVector (T _x, T _y, T _z)
 Construct a vector.
 TVector (T _x, T _y, T _z, T _w)
 Construct a vector or point.
TVector operator- () const
 Invert the vector.
length () const
 Return the length of the vector.
TVector normalize () const
 Return a vector with a length of 1.0 in the same orientation as the original vector.

Public Attributes

x
 x-axis value.
y
 y-axis value.
z
 z-axis value.
w
 0.0 means vector, 1.0 means point.

Constructor & Destructor Documentation

template<class T>
camvox::TVector< T >::TVector ( void   )  [inline]

Construct a zero vector.

template<class T>
camvox::TVector< T >::TVector ( _x,
_y,
_z 
) [inline]

Construct a vector.

Parameters:
_x x-axis value
_y y-axis value
_z z-axis value

template<class T>
camvox::TVector< T >::TVector ( _x,
_y,
_z,
_w 
) [inline]

Construct a vector or point.

Parameters:
_x x-axis value
_y y-axis value
_z z-axis value
_w 0.0 means vector, 1.0 means point


Member Function Documentation

template<class T>
TVector camvox::TVector< T >::operator- (  )  const [inline]

Invert the vector.

Or mirror the point throught the origin.

template<class T>
T camvox::TVector< T >::length (  )  const [inline]

Return the length of the vector.

Or the distance between the point and the origin.

template<class T>
TVector camvox::TVector< T >::normalize (  )  const [inline]

Return a vector with a length of 1.0 in the same orientation as the original vector.

Or translate the point to lay on the surface of a unit sphere.


Member Data Documentation

template<class T>
T camvox::TVector< T >::x

x-axis value.

template<class T>
T camvox::TVector< T >::y

y-axis value.

template<class T>
T camvox::TVector< T >::z

z-axis value.

template<class T>
T camvox::TVector< T >::w

0.0 means vector, 1.0 means point.


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