Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

TVector4 Class Template Reference
[Math4]

Template class for 4D geometric vectors. More...

#include <gmlvector4.h>

List of all members.

Public Member Functions

Constructors
 TVector4 ()
 No initialization.

 TVector4 (double v)
 Initialization by scalar.

 TVector4 (double x0, double y0, double z0, double w0)
 Initialization by given components.

 TVector4 (const TVector3< T > &v, double w0=1)
 Initialization by given 3d-vector (w become equal to 1).

Element access
T & operator[] (int i)
const T & operator[] (int i) const
void SetValue (double x0, double y0, double z0, double w0)
 Set elements by 3 double components.

void SetValue (double a)
 Set all the elements to the same T value.

Conversions
 operator T * ()
 Convert a TVector to array of (3) elements.

 operator const T * () const
 Convert a TVector to array of (3) elements.

Binary operations
TVector4< T > & operator+= (const TVector4< T > &u)
TVector4< T > & operator-= (const TVector4< T > &u)
TVector4< T > operator+ (const TVector4< T > &u) const
TVector4< T > operator- (const TVector4< T > &u) const
TVector4< T > & operator *= (const double d)
TVector4< T > & operator/= (const double d)
TVector4< T > MultVec (const TVector4< T > &u) const
 Vector scaling (this vector is not modified).

TVector4< T > DivVec (const TVector4< T > &u) const
 Vector-by vector division (this vector is not modified).

TVector4< T > operator * (const double d) const
TVector4< T > operator/ (const double d) const
double operator * (const TVector4< T > &rhs) const
 dot product

double DotProduct (const TVector4< T > &rhs) const
 dot product

Unary operations
void Negate ()
 Vector (self) negation.

TVector4< T > operator- () const
 Unary negation operator.

TVector4< double > operator~ () const
 returns normalized vector (always double)

TVector4< T > & Normalize ()
 Normalize this vector, return vector itself.

double Length () const
 Length of the vector.

double operator! () const
 Length of the vector.

Service methods
void Clip (double vmin, double vmax)
 Clip elements of this TVector to constraints from vmin to vmax.

bool Normalized () const
 Test whether the TVector is normalized.

double SqrLength () const
 Squared length of vector.

bool LessOrEqual (const TVector4< T > &u) const
 Return true if all components of this vector less of equal than u.

bool LessOrEqual (const TVector3< T > &u) const
 Return true if all components of this vector less of equal than u.

MaxValue () const
 Return C-norm of the vector (maximal value among coords).

TVector3< double > Homogenize ()
MFC, VCL, OWL - specific functions (defined only if proper defines are found)
 TVector4 (const TPoint &p)
TVector4< T > & operator= (const TPoint &p)
 operator TPoint ()
 TVector4 (const CPoint &p)
 TVector4 (const CSize &p)
TVector4< T > & operator= (const CPoint &p)
TVector4< T > & operator= (const CSize &p)
 operator CPoint ()
 operator CvPoint ()
 TVector4 (const CvPoint &p)
TVector4 operator= (const CvPoint &p)

Static Public Member Functions

const TVector4< T > & Cast (const T *u)
 Treat array of (3) elements as a TVector.

TVector4< T > & Cast (T *u)
 Treat array of (3) elements as a TVector.


Related Functions

(Note that these are not member functions.)

TVector4< T > operator * (const double d, const TVector4< T > &u)
 Multiplication of scalar d by TVector u.

double SqrLength (const TVector4< T > &u)
 Squared length of given vector.

double Length (const TVector4< T > &u)
 Length of the vector.

double DotProduct (const TVector4< T > &v1, const TVector4< T > &v2)
 Dot product.

TVector4< T_TO > Conv (const TVector4< T_FROM > &u)
 Convert TVector4<T_FROM> to TVector4<T_TO>.

TVector4< float > ConvF (const TVector4< T > &u)
 Convert TVector4<T> to TVector4<float>.

TVector4< double > ConvD (const TVector4< T > &u)
 Convert TVector4<T> to TVector4<double>.

TVector4< int > ConvI (const TVector4< T > &u)
 Convert TVector4<T> to TVector4<int>.

TVector4< short > ConvS (const TVector4< T > &u)
 Convert TVector4<T> to TVector4<int>.


Detailed Description

template<class T>
class gml::TVector4< T >

Template class for 4D geometric vectors.

Parameters:
T - template type of TVector elements
Warning:
Use it with some SIGNED integral type, or a real type


The documentation for this class was generated from the following file:
Generated on Tue Jan 13 21:12:07 2004 for Graphics and Media Lab CSL by doxygen 1.3.4