#include <vector4.h>
Public Member Functions |
|
Constructors and Destructors
|
|
TVector4 () | |
Default constructor. |
|
TVector4 (const T *ptr) throw (Exception::NullPointer) | |
Array constructor. |
|
TVector4 (const T &value) | |
Scalar constructor. |
|
TVector4 (const T &x, const T &y, const T &z, const T &h=(T) 1) | |
Detailed constructor. |
|
TVector4 (const TVector4 &vector) | |
Copy constructor. |
|
virtual | ~TVector4 () |
Destructor. |
|
virtual void | clear () |
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) |
Assign the vector components.
|
|
void | set (const TVector4 &vector) |
Assign from another TVector4. |
|
TVector4 & | operator= (const T *ptr) throw (Exception::NullPointer) |
Array assignment operator. |
|
TVector4 & | operator= (const TVector4 &vector) |
Assignment operator. |
|
TVector4 & | operator= (T value) |
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 |
Assign to four variables of type
T . |
|
void | get (TVector4 &vector) const |
Assign to another Vector4. |
|
void | swap (TVector4 &vector) |
Swap the contents of two vectors.
|
|
Arithmetic operators
|
|
TVector4 | operator+ () const |
Positive sign. |
|
TVector4 | operator- () const |
Negative sign. |
|
TVector4 & | operator+= (const TVector4 &vector) |
Add a vector to this vector.
|
|
TVector4 & | operator-= (const TVector4 &vector) |
Subtract a vector from this vector.
|
|
TVector4 | operator* (const T &scalar) |
Scalar product. |
|
TVector4 & | operator*= (const T &scalar) |
Multiply by a scalar. |
|
TVector4 | operator/ (const T &scalar) throw (Exception::DivisionByZero) |
Fraction of a vector. |
|
TVector4 & | operator/= (const T &scalar) throw (Exception::DivisionByZero) |
Divide a vector by a scalar.
|
|
T | operator* (const TVector4 &vector) const |
Dot product. |
|
T | getDistance (const TVector4 &vector) const |
Return the distance to another
vector. |
|
T | getSquareDistance (const TVector4 &vector) const |
Return the squared distance to
another vector. |
|
Predicates
|
|
bool | operator== (const TVector4 &vector) const |
Equality operator. |
|
bool | operator!= (const TVector4 &vector) const |
Inequality operator. |
|
bool | isOrthogonalTo (const TVector4 &vector) const |
Orthogonality predicate. |
|
Debugging and Diagnostics
|
|
bool | isValid () const |
Test whether instance is valid.
|
|
void | dump (std::ostream &s=std::cout, Size depth=0) const |
Internal state dump. |
|
Public Attributes |
|
Attributes
|
|
All vector components are public members for
convenience.
|
|
T | x |
x component of the vector |
|
T | y |
y component of the vector |
|
T | z |
z component of the vector |
|
T | h |
height component of the
vector |
|
Accessors |
|
T | getLength () const |
Return the length of the vector.
|
|
T | getSquareLength () const |
Return the squared length of the
vector. |
|
TVector4 & | normalize () throw (Exception::DivisionByZero) |
Normalize the vector. |
|
void | set (const T &value=(T) 1) |
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. |
|
static const TVector4 & | getZero () |
Return a vector with all components
0. |
|
static const TVector4 & | getUnit () |
Return a vector with all components
1. |
Representation of points and vectors in four-dimensional space.