wVector class More...

Inheritance diagram for wVectorT< Shared >:

Public Member Functions

 wVectorT ()
 Constructor.
 
template<bool OtherShared>
 wVectorT (const wVectorT< OtherShared > &)
 The function to copy from another kind of wVectorT.
 
 wVectorT (const wVectorT &)
 Copy-Constructor.
 
 wVectorT (const real *ptr)
 Constructor.
 
 wVectorT (real *ptr)
 Constructor.
 
 wVectorT (real x, real y, real z, real w=1.0)
 Constructor.
 
template<>
 wVectorT (const wVectorT< OtherShared > &src)
 
template<>
 wVectorT (const wVectorT< false > &src)
 
template<>
 wVectorT (const real *ptr)
 
template<>
 wVectorT (real *ptr)
 
template<>
 wVectorT (real _x, real _y, real _z, real _w)
 
template<bool OtherShared>
wVectorT< false > compProduct (const wVectorT< OtherShared > &A) const
 component wise multiplication
 
real norm () const
 return the norm of this vector
 
wVectorTnormalize ()
 Normalize the vector.
 
 operator qglviewer::Vec () const
 Convert to qglviewer::Vec.
 
template<bool OtherShared>
real operator% (const wVectorT< OtherShared > &A) const
 return dot product
 
template<bool OtherShared>
wVectorT< false > operator* (const wVectorT< OtherShared > &B) const
 return cross product
 
const wVectorToperator+ () const
 Operator + (unary)
 
template<bool OtherShared>
wVectorT< false > operator+ (const wVectorT< OtherShared > &A) const
 Operator +.
 
template<bool OtherShared>
wVectorToperator+= (const wVectorT< OtherShared > &A)
 Operator +=.
 
wVectorT< false > operator- () const
 Operator - (unary)
 
template<bool OtherShared>
wVectorT< false > operator- (const wVectorT< OtherShared > &A) const
 Operator -.
 
template<bool OtherShared>
wVectorToperator-= (const wVectorT< OtherShared > &A)
 Operator -=.
 
wVectorToperator= (const wVectorT &A)
 Assignment.
 
template<bool OtherShared>
wVectorToperator= (const wVectorT< OtherShared > &A)
 Assignment.
 
template<bool OtherShared>
bool operator== (const wVectorT< OtherShared > &A) const
 Compare only the first three elements and return true if their are equals.
 
real & operator[] (int i)
 indexing operator
 
const real & operator[] (int i) const
 indexing operator (const version)
 
wVectorTrotateAround (wVectorT< false > axis, real theta)
 rotate the position indicated by this wVectorT around the axis by the angle theta
 
wVectorT< false > scale (real s) const
 return a new wVectorT with element scaled by s
 

Static Public Member Functions

template<bool SharedA, bool SharedB>
static real distance (const wVectorT< SharedA > &A, const wVectorT< SharedB > &B)
 return the distance from A to B
 
static wVectorT< false > X ()
 X axis vector.
 
static wVectorT< false > Y ()
 Y axis vector.
 
static wVectorT< false > Z ()
 Z axis vector.
 

Public Attributes

real & w
 
real & x
 
real & y
 
real & z
 

Additional Inherited Members

- Protected Attributes inherited from InternalData< Shared >
real data [4]
 

Detailed Description

template<bool Shared = false>
class farsa::wVectorT< Shared >

wVector class

\

Motivation
4 dimensional Vector of real numbers; useful for transformation matrix, quaternion and 3d points and vectors.
Description
This class has a template parameter which allows to choose whether to have inner data or shared data. In case of shared data this can only be constructed using the constructor having a pointer to a vector of real as a parameter.
Warnings
When it is used as 3-dimensional vector the fourth value is set to 1.0

Definition at line 69 of file wvector.h.

Constructor & Destructor Documentation

wVectorT ( )

Constructor.

wVectorT ( const wVectorT< OtherShared > &  )

The function to copy from another kind of wVectorT.

wVectorT ( const wVectorT< Shared > &  )

Copy-Constructor.

wVectorT ( const real *  ptr)

Constructor.

wVectorT ( real *  ptr)
inline

Constructor.

Definition at line 239 of file wvector.h.

wVectorT ( real  x,
real  y,
real  z,
real  w = 1.0 
)

Constructor.

Member Function Documentation

wVectorT< false > compProduct ( const wVectorT< OtherShared > &  A) const
inline

component wise multiplication

Definition at line 391 of file wvector.h.

real distance ( const wVectorT< SharedA > &  A,
const wVectorT< SharedB > &  B 
)
inlinestatic

return the distance from A to B

Definition at line 402 of file wvector.h.

real norm ( ) const
inline

return the norm of this vector

Definition at line 396 of file wvector.h.

Referenced by RenderWorld::drawArrow(), and PhyiCub::PhyiCub().

wVectorT< Shared > & normalize ( )
inline

Normalize the vector.

Returns
itself normalized

Definition at line 295 of file wvector.h.

Referenced by RenderWObjectContainer::drawCylinder(), wMatrix::grammSchmidt(), and wVectorT< Shared >::rotateAround().

operator qglviewer::Vec ( ) const
inline

Convert to qglviewer::Vec.

Definition at line 275 of file wvector.h.

real operator% ( const wVectorT< OtherShared > &  A) const
inline

return dot product

Definition at line 375 of file wvector.h.

wVectorT< false > operator* ( const wVectorT< OtherShared > &  B) const
inline

return cross product

Definition at line 381 of file wvector.h.

const wVectorT< Shared > & operator+ ( ) const
inline

Operator + (unary)

Definition at line 311 of file wvector.h.

wVectorT< false > operator+ ( const wVectorT< OtherShared > &  A) const
inline

Operator +.

Definition at line 317 of file wvector.h.

wVectorT< Shared > & operator+= ( const wVectorT< OtherShared > &  A)
inline

Operator +=.

Definition at line 349 of file wvector.h.

wVectorT< false > operator- ( ) const
inline

Operator - (unary)

Definition at line 306 of file wvector.h.

wVectorT< false > operator- ( const wVectorT< OtherShared > &  A) const
inline

Operator -.

Definition at line 323 of file wvector.h.

wVectorT< Shared > & operator-= ( const wVectorT< OtherShared > &  A)
inline

Operator -=.

Definition at line 359 of file wvector.h.

wVectorT< Shared > & operator= ( const wVectorT< Shared > &  A)
inline

Assignment.

Definition at line 328 of file wvector.h.

wVectorT< Shared > & operator= ( const wVectorT< OtherShared > &  A)
inline

Assignment.

Definition at line 339 of file wvector.h.

bool operator== ( const wVectorT< OtherShared > &  A) const
inline

Compare only the first three elements and return true if their are equals.

Definition at line 369 of file wvector.h.

real & operator[] ( int  i)
inline

indexing operator

Definition at line 280 of file wvector.h.

const real & operator[] ( int  i) const
inline

indexing operator (const version)

Definition at line 285 of file wvector.h.

wVectorT< Shared > & rotateAround ( wVectorT< false >  axis,
real  theta 
)
inline

rotate the position indicated by this wVectorT around the axis by the angle theta

Parameters
axisspecify the axis of rotation
thetaspecify the angle of rotation (right-hand system)
Returns
itself rotated

Definition at line 408 of file wvector.h.

References wVectorT< Shared >::normalize().

Referenced by wMatrix::rotateAround().

wVectorT< false > scale ( real  s) const
inline
wVectorT< false > X ( )
inlinestatic

X axis vector.

Definition at line 171 of file wvector.h.

wVectorT< false > Y ( )
inlinestatic

Y axis vector.

Definition at line 176 of file wvector.h.

wVectorT< false > Z ( )
inlinestatic

Z axis vector.

Definition at line 181 of file wvector.h.


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