wVector class More...

Inheritance diagram for wVectorT< Shared >:

Public Member Functions

 wVectorT ()
 Constructor. More...
 
template<bool OtherShared>
 wVectorT (const wVectorT< OtherShared > &)
 The function to copy from another kind of wVectorT. More...
 
 wVectorT (const wVectorT &)
 Copy-Constructor. More...
 
 wVectorT (const real *ptr)
 Constructor. More...
 
 wVectorT (real *ptr)
 Constructor. More...
 
 wVectorT (real x, real y, real z, real w=1.0)
 Constructor. More...
 
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 More...
 
real norm () const
 return the norm of this vector More...
 
wVectorTnormalize ()
 Normalize the vector. More...
 
wVectorT< false > normalized () const
 Returns a normalized vector with the same direction of the current vector. More...
 
 operator qglviewer::Vec () const
 Convert to qglviewer::Vec. More...
 
 operator QString () const
 Returns a string representation of the vector. More...
 
template<bool OtherShared>
real operator% (const wVectorT< OtherShared > &A) const
 return dot product More...
 
template<bool OtherShared>
wVectorT< false > operator* (const wVectorT< OtherShared > &B) const
 return cross product More...
 
const wVectorToperator+ () const
 Operator + (unary) More...
 
template<bool OtherShared>
wVectorT< false > operator+ (const wVectorT< OtherShared > &A) const
 Operator +. More...
 
template<bool OtherShared>
wVectorToperator+= (const wVectorT< OtherShared > &A)
 Operator +=. More...
 
template<bool OtherShared>
wVectorT< Shared > & operator+= (const wVectorT< OtherShared > &A)
 
wVectorT< false > operator- () const
 Operator - (unary) More...
 
template<bool OtherShared>
wVectorT< false > operator- (const wVectorT< OtherShared > &A) const
 Operator -. More...
 
template<bool OtherShared>
wVectorToperator-= (const wVectorT< OtherShared > &A)
 Operator -=. More...
 
template<bool OtherShared>
wVectorT< Shared > & operator-= (const wVectorT< OtherShared > &A)
 
wVectorToperator= (const wVectorT &A)
 Assignment. More...
 
template<bool OtherShared>
wVectorToperator= (const wVectorT< OtherShared > &A)
 Assignment. More...
 
template<bool OtherShared>
wVectorT< Shared > & operator= (const wVectorT< OtherShared > &A)
 
template<bool OtherShared>
bool operator== (const wVectorT< OtherShared > &A) const
 Compare only the first three elements and return true if their are equals. More...
 
realoperator[] (int i)
 indexing operator More...
 
const realoperator[] (int i) const
 indexing operator (const version) More...
 
wVectorTrotateAround (wVectorT< false > axis, real theta)
 rotate the position indicated by this wVectorT around the axis by the angle theta More...
 
wVectorT< false > scale (real s) const
 return a new wVectorT with element scaled by s More...
 

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 More...
 
static wVectorT< false > X ()
 X axis vector. More...
 
static wVectorT< false > Y ()
 Y axis vector. More...
 
static wVectorT< false > Z ()
 Z axis vector. More...
 

Public Attributes

realw
 
realx
 
realy
 
realz
 

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 71 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 249 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 417 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 428 of file wvector.h.

real norm ( ) const
inline

return the norm of this vector

Definition at line 422 of file wvector.h.

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

wVectorT< Shared > & normalize ( )
inline

Normalize the vector.

Returns
itself normalized

Definition at line 310 of file wvector.h.

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

wVectorT< false > normalized ( ) const
inline

Returns a normalized vector with the same direction of the current vector.

Returns
the normalized vector

Definition at line 321 of file wvector.h.

operator qglviewer::Vec ( ) const
inline

Convert to qglviewer::Vec.

Definition at line 290 of file wvector.h.

operator QString ( ) const
inline

Returns a string representation of the vector.

Definition at line 285 of file wvector.h.

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

return dot product

Definition at line 401 of file wvector.h.

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

return cross product

Definition at line 407 of file wvector.h.

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

Operator + (unary)

Definition at line 337 of file wvector.h.

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

Operator +.

Definition at line 343 of file wvector.h.

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

Operator +=.

wVectorT< false > operator- ( ) const
inline

Operator - (unary)

Definition at line 332 of file wvector.h.

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

Operator -.

Definition at line 349 of file wvector.h.

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

Operator -=.

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

Assignment.

Definition at line 354 of file wvector.h.

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

Assignment.

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

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

Definition at line 395 of file wvector.h.

real & operator[] ( int  i)
inline

indexing operator

Definition at line 295 of file wvector.h.

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

indexing operator (const version)

Definition at line 300 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 434 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 181 of file wvector.h.

wVectorT< false > Y ( )
inlinestatic

Y axis vector.

Definition at line 186 of file wvector.h.

wVectorT< false > Z ( )
inlinestatic

Z axis vector.

Definition at line 191 of file wvector.h.


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