libt3d  2.6
Public Member Functions | Public Attributes | Friends
V3D Struct Reference

A 3D vector. More...

#include <v3d.h>

List of all members.

Public Member Functions

 V3D (void)
 Vector constructor.
 V3D (double x, double y, double z)
 Vector constructor.
double & operator[] (unsigned int i)
 Vector element accessor.
double & operator() (unsigned int i)
 Vector element accessor.
double & operator[] (V3DVectorIndex i)
V3D operator+ (const V3D &inV) const
 Sum of two vectors or of a vector and a point.
V3D operator+= (const V3D &inV)
 Sum of two vectors or of a vector and a point.
V3D operator- () const
 the opposite vector.
V3D operator- (const V3D &inV) const
 Substraction of two vectors or of a vector and a point.
V3D operator-= (const V3D &inV)
 Substraction of two vectors or of a vector and a point.
V3D operator/ (const double d) const
 Divide the vector by an double.
V3D operator/= (const double d)
 Divide the vector by an double.
V3D operator* (const double d) const
 Multiply the vector by a double.
V3D operator*= (const double d)
 Multiply the vector by a double.
double operator* (const V3D &inV) const
 dot product
V3D operator^ (const V3D &inV) const
 Vector product.
bool operator== (const V3D &inV) const
 Vector comparison.
double norm () const
 Compute euclidian norm of a V3D.
V3Dnormalize ()
 Normalize a V3D.

Public Attributes

double v [4]
 Homogeneous coordinates.

Friends

std::ostream & operator<< (std::ostream &os, const V3D &v3d)
 Output a ASCII V3D description to a stream.

Detailed Description

A 3D vector.

This structure manipulates vectors represented by homogeneous coordinates.


Constructor & Destructor Documentation

V3D ( void  ) [inline]

Vector constructor.

Initialize a vector to all 0.

V3D ( double  x,
double  y,
double  z 
) [inline]

Vector constructor.

Initialize a vector to x,y and z.

Parameters:
[in]xX coordinate.
[in]yY coordinate.
[in]zZ coordinate.

Member Function Documentation

double norm ( ) const [inline]

Compute euclidian norm of a V3D.

Parameters:
[in]v3dInput vector
Returns:
the euclidian norm of the vector.
V3D & normalize ( ) [inline]

Normalize a V3D.

Parameters:
inout]v3d Input vector.
Returns:
the normalized vector.
double & operator() ( unsigned int  i) [inline]

Vector element accessor.

Parameters:
in)i Element number.
Returns:
A reference on the element value.
V3D operator* ( const double  d) const [inline]

Multiply the vector by a double.

Parameters:
[in]ddouble to multiply
Returns:
the result of the multiplication.
double operator* ( const V3D inV) const [inline]

dot product

Parameters:
[in]inVVector to multiply
Returns:
the result of the dot product.
V3D operator*= ( const double  d) [inline]

Multiply the vector by a double.

Parameters:
[in]ddouble to multiply
Returns:
the result of the multiplication.
V3D operator+ ( const V3D inV) const [inline]

Sum of two vectors or of a vector and a point.

Parameters:
[in]inVVector to sum.
Returns:
the result of the addition.
V3D operator+= ( const V3D inV) [inline]

Sum of two vectors or of a vector and a point.

Parameters:
[in]inVVector to sum.
Returns:
the result of the addition.
V3D operator- ( ) const [inline]

the opposite vector.

Returns:
the opposite vector.
V3D operator- ( const V3D inV) const [inline]

Substraction of two vectors or of a vector and a point.

Parameters:
[in]inVVector to substract.
Returns:
the result of the substraction.
V3D operator-= ( const V3D inV) [inline]

Substraction of two vectors or of a vector and a point.

Parameters:
[in]inVVector to substract.
Returns:
the result of the substraction.
V3D operator/ ( const double  d) const [inline]

Divide the vector by an double.

Parameters:
[in]ddouble to divide
Returns:
the result of the division.
V3D operator/= ( const double  d) [inline]

Divide the vector by an double.

Parameters:
[in]ddouble to divide
Returns:
the result of the division.
bool operator== ( const V3D inV) const [inline]

Vector comparison.

Parameters:
[in]inVVector to compare
Returns:
the result of the comparison.
double & operator[] ( unsigned int  i) [inline]

Vector element accessor.

Parameters:
[in]iElement number.
Returns:
A reference on the element value.
double & operator[] ( V3DVectorIndex  i) [inline]
V3D operator^ ( const V3D inV) const [inline]

Vector product.

Parameters:
[in]inVVector to multiply
Returns:
the result of the cross product.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const V3D v3d 
) [friend]

Output a ASCII V3D description to a stream.

Parameters:
[in]sStream to dump on.
[in]v3dV3D to dump.
Returns:
reference on the output stream.