Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

TVector4< T > Class Template Reference
[Four-dimensional vector.]

Generic Four-Dimensional Vector. More...

#include <vector4.h>

List of all members.

Accessors

getLength () const throw ()
 Return the length of the vector.
getSquareLength () const throw ()
 Return the squared length of the vector.
TVector4normalize () throw (Exception::DivisionByZero)
 Normalize the vector.
void set (const T &value=(T) 1) throw ()
 Assign one value to all vector components.
T & operator[] (Position position) throw (Exception::IndexOverflow)
 Mutable array-like access to the components.
const T & operator[] (Position position) const throw (Exception::IndexOverflow)
 Constant array-like access to the components.
const TVector4getZero () throw ()
 Return a vector with all components 0.
const TVector4getUnit () throw ()
 Return a vector with all components 1.

Public Member Functions

Constructors and Destructors
 TVector4 () throw ()
 Default constructor.
 TVector4 (const T *ptr) throw (Exception::NullPointer)
 Array constructor.
 TVector4 (const T &value) throw ()
 Scalar constructor.
 TVector4 (const T &x, const T &y, const T &z, const T &h=(T) 1) throw ()
 Detailed constructor.
 TVector4 (const TVector4 &vector) throw ()
 Copy constructor.
virtual ~TVector4 () throw ()
 Destructor.
virtual void clear () throw ()
 Clear method The values are set to 0.
Assignment
void set (const T *ptr) throw (Exception::NullPointer)
 Assign from an array.
void set (const T &rx, const T &ry, const T &rz, const T &rh=(T) 1) throw ()
 Assign the vector components.
void set (const TVector4 &vector) throw ()
 Assign from another TVector4.
TVector4operator= (const T *ptr) throw (Exception::NullPointer)
 Array assignment operator.
TVector4operator= (const TVector4 &vector) throw ()
 Assignment operator.
TVector4operator= (T value) throw ()
 Assignment operator.
void get (T *ptr) const throw (Exception::NullPointer)
 Assign to an array.
void get (T &rx, T &ry, T &rz, T &rh) const throw ()
 Assign to four variables of type T.
void get (TVector4 &vector) const throw ()
 Assign to another Vector4.
void swap (TVector4 &vector) throw ()
 Swap the contents of two vectors.
Arithmetic operators
TVector4 operator+ () const throw ()
 Positive sign.
TVector4 operator- () const throw ()
 Negative sign.
TVector4operator+= (const TVector4 &vector) throw ()
 Add a vector to this vector.
TVector4operator-= (const TVector4 &vector) throw ()
 Subtract a vector from this vector.
TVector4 operator * (const T &scalar) throw ()
 Scalar product.
TVector4operator *= (const T &scalar) throw ()
 Multiply by a scalar.
TVector4 operator/ (const T &scalar) throw (Exception::DivisionByZero)
 Fraction of a vector.
TVector4operator/= (const T &scalar) throw (Exception::DivisionByZero)
 Divide a vector by a scalar.
operator * (const TVector4 &vector) const throw ()
 Dot product.
getDistance (const TVector4 &vector) const throw ()
 Return the distance to another vector.
getSquareDistance (const TVector4 &vector) const throw ()
 Return the squared distance to another vector.
Predicates
bool operator== (const TVector4 &vector) const throw ()
 Equality operator.
bool operator!= (const TVector4 &vector) const throw ()
 Inequality operator.
bool isOrthogonalTo (const TVector4 &vector) const throw ()
 Orthogonality predicate.
Debugging and Diagnostics
bool isValid () const throw ()
 Test whether instance is valid.
void dump (std::ostream &s=std::cout, Size depth=0) const throw ()
 Internal state dump.

Public Attributes

Attributes
All vector components are public members for convenience.

x
 x component of the vector
y
 y component of the vector
z
 z component of the vector
h
 height component of the vector


Detailed Description

template<typename T>
class TVector4< T >

Generic Four-Dimensional Vector.

Representation of points and vectors in four-dimensional space.