Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

salt::TVector< DATATYPE, ELEMENTS, TYPE > Class Template Reference

TVector is a template class for vector implementations. More...

#include <tvector.h>

Inheritance diagram for salt::TVector< DATATYPE, ELEMENTS, TYPE >:

Inheritance graph
[legend]
Collaboration diagram for salt::TVector< DATATYPE, ELEMENTS, TYPE >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TVector ()
f_inline DATATYPE & operator[] (int row)
 returns a reference to a row of the vector
f_inline const DATATYPE & operator[] (int row) const
 returns a constant reference to a row of a vector
f_inline DATATYPE & Get (int row)
 returns a reference to a row of a vector
f_inline const DATATYPE & Get (int row) const
 returns a constant reference to a row of a vector
f_inline const TYPE & SetData (const DATATYPE *copy)
 copies another vector 'copy'
f_inline DATATYPE * GetData ()
 return a pointer to the encapsulated vector
void Dump () const
 prints the contents of vector to stdout
f_inline const TYPE & Fill (const DATATYPE &fill)
 fills all components of the vector with value 'fill'
f_inline TYPE & Zero ()
 sets all components of the vector to 0
f_inline const TYPE operator+ (const TYPE &v) const
 calculates this VECTOR + VECTOR
f_inline const TYPE operator- (const TYPE &v) const
 calculates VECTOR - VECTOR
f_inline const TYPE operator * (const DATATYPE &v) const
 calculates VECTOR * VECTOR
f_inline const TYPE operator/ (const DATATYPE &v) const
 calculates VECTOR / SCALAR
f_inline TYPE & operator+= (const TYPE &v)
 add another vector
f_inline TYPE & operator-= (const TYPE &v)
 substracts another vector
f_inline TYPE & operator *= (const DATATYPE &v)
 multiplies another vector
f_inline TYPE & operator/= (const DATATYPE &v)
 divides another vector
f_inline TYPE operator- () const
 returns the negate of this vector
f_inline bool operator== (const TYPE &v) const
 returns true if this vector and v are equal
f_inline bool operator!= (const TYPE &v) const
 returns true if this vector and v are not equal
f_inline DATATYPE Dot (const TYPE &v) const
 returns the dot product from this vector and v
f_inline const TYPE & Normalize ()
 normalizes the vector
f_inline TYPE Normalized () const
 calculates the normalized vector, not modifying the vector
f_inline DATATYPE SquareLength () const
 calculates the squared length of the vector
f_inline DATATYPE Length () const
 calculates the length of the vector
f_inline int GetLeastSignificantAxis () const
 returns the index of least significant axis
f_inline int GetMostSignificantAxis () const
 returns the index of the most significant axis
f_inline TYPE LinearInterpolate (const TYPE &to, float delta) const
 lineary interpolates between this vector and to with an delta increment
f_inline TYPE NormalizedLinearInterpolate (const TYPE &to, float delta) const
 lineary interpolates between this vector and to with an delta increment, returning a normalized vector

Protected Member Functions

 TVector (const TYPE &v)
const DATATYPE & El (int index) const
DATATYPE & El (int index)

Private Attributes

DATATYPE mData [ELEMENTS]

Detailed Description

template<typename DATATYPE, int ELEMENTS, typename TYPE>
class salt::TVector< DATATYPE, ELEMENTS, TYPE >

TVector is a template class for vector implementations.

It abstracts away the number of elements and their type.

Definition at line 51 of file tvector.h.


Constructor & Destructor Documentation

template<typename DATATYPE, int ELEMENTS, typename TYPE>
salt::TVector< DATATYPE, ELEMENTS, TYPE >::TVector  )  [inline]
 

Definition at line 57 of file tvector.h.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
salt::TVector< DATATYPE, ELEMENTS, TYPE >::TVector const TYPE &  v  )  [inline, protected]
 

Definition at line 165 of file tvector.h.


Member Function Documentation

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline DATATYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::Dot const TYPE &  v  )  const
 

returns the dot product from this vector and v

Definition at line 460 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

Referenced by salt::BoundingSphere::Encapsulate(), salt::BoundingSphere::EncapsulateFast(), salt::Plane::GetDistanceTo(), salt::Plane::GetOrientation(), salt::Plane::Plane(), salt::Plane::Set(), and oxygen::PlaneCollider::SetParams().

template<typename DATATYPE, int ELEMENTS, typename TYPE>
void salt::TVector< DATATYPE, ELEMENTS, TYPE >::Dump  )  const [inline]
 

prints the contents of vector to stdout

Definition at line 322 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
DATATYPE& salt::TVector< DATATYPE, ELEMENTS, TYPE >::El int  index  )  [inline, protected]
 

Definition at line 176 of file tvector.h.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
const DATATYPE& salt::TVector< DATATYPE, ELEMENTS, TYPE >::El int  index  )  const [inline, protected]
 

Definition at line 172 of file tvector.h.

Referenced by salt::TVector< float, 3, Vector3f >::Get(), and salt::TVector< float, 3, Vector3f >::operator[]().

template<typename DATATYPE, int ELEMENTS, class TYPE>
f_inline const TYPE & salt::TVector< DATATYPE, ELEMENTS, TYPE >::Fill const DATATYPE &  fill  ) 
 

fills all components of the vector with value 'fill'

Definition at line 331 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline const DATATYPE& salt::TVector< DATATYPE, ELEMENTS, TYPE >::Get int  row  )  const [inline]
 

returns a constant reference to a row of a vector

Definition at line 73 of file tvector.h.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline DATATYPE& salt::TVector< DATATYPE, ELEMENTS, TYPE >::Get int  row  )  [inline]
 

returns a reference to a row of a vector

Definition at line 70 of file tvector.h.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline DATATYPE* salt::TVector< DATATYPE, ELEMENTS, TYPE >::GetData  )  [inline]
 

return a pointer to the encapsulated vector

Definition at line 81 of file tvector.h.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline int salt::TVector< DATATYPE, ELEMENTS, TYPE >::GetLeastSignificantAxis  )  const
 

returns the index of least significant axis

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline int salt::TVector< DATATYPE, ELEMENTS, TYPE >::GetMostSignificantAxis  )  const
 

returns the index of the most significant axis

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline DATATYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::Length  )  const [inline]
 

calculates the length of the vector

Definition at line 143 of file tvector.h.

Referenced by VisionPerceptor::DynamicAxisPercept(), RestrictedVisionPerceptor::DynamicAxisPercept(), salt::BoundingSphere::Encapsulate(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::Normalize(), salt::Plane::Normalize(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::Normalized(), DriveEffector::PrePhysicsUpdateInternal(), KickEffector::Realize(), CatchEffector::Realize(), VisionPerceptor::SetupVisibleObjects(), RestrictedVisionPerceptor::SetupVisibleObjects(), VisionPerceptor::StaticAxisPercept(), and RestrictedVisionPerceptor::StaticAxisPercept().

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline TYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::LinearInterpolate const TYPE &  to,
float  delta
const
 

lineary interpolates between this vector and to with an delta increment

Definition at line 502 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

Referenced by salt::TVector< float, 3, Vector3f >::NormalizedLinearInterpolate().

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline const TYPE & salt::TVector< DATATYPE, ELEMENTS, TYPE >::Normalize  ) 
 

normalizes the vector

Definition at line 470 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::Length(), and salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

Referenced by salt::Matrix::LookAt(), oxygen::VelocityController::PrePhysicsUpdateInternal(), DriveEffector::Realize(), and oxygen::PlaneCollider::SetParams().

Here is the call graph for this function:

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline TYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::Normalized  )  const
 

calculates the normalized vector, not modifying the vector

Definition at line 480 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::Length(), and salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

Referenced by salt::BoundingSphere::Encapsulate(), salt::Matrix::LookAt(), salt::Plane::Plane(), and salt::Plane::Set().

Here is the call graph for this function:

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline TYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::NormalizedLinearInterpolate const TYPE &  to,
float  delta
const [inline]
 

lineary interpolates between this vector and to with an delta increment, returning a normalized vector

Definition at line 158 of file tvector.h.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline const TYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator * const DATATYPE &  v  )  const
 

calculates VECTOR * VECTOR

Definition at line 379 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline TYPE & salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator *= const DATATYPE &  v  ) 
 

multiplies another vector

Definition at line 418 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline bool salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator!= const TYPE &  v  )  const
 

returns true if this vector and v are not equal

Definition at line 453 of file tvector.h.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline const TYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator+ const TYPE &  v  )  const
 

calculates this VECTOR + VECTOR

Definition at line 357 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline TYPE & salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator+= const TYPE &  v  ) 
 

add another vector

Definition at line 400 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline TYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator-  )  const
 

returns the negate of this vector

Definition at line 436 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline const TYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator- const TYPE &  v  )  const
 

calculates VECTOR - VECTOR

Definition at line 368 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline TYPE & salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator-= const TYPE &  v  ) 
 

substracts another vector

Definition at line 409 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline const TYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator/ const DATATYPE &  v  )  const
 

calculates VECTOR / SCALAR

Definition at line 390 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline TYPE & salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator/= const DATATYPE &  v  ) 
 

divides another vector

Definition at line 427 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline bool salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator== const TYPE &  v  )  const
 

returns true if this vector and v are equal

Definition at line 446 of file tvector.h.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline const DATATYPE& salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator[] int  row  )  const [inline]
 

returns a constant reference to a row of a vector

Definition at line 66 of file tvector.h.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline DATATYPE& salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator[] int  row  )  [inline]
 

returns a reference to a row of the vector

Definition at line 62 of file tvector.h.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
const TYPE & salt::TVector< DATATYPE, ELEMENTS, TYPE >::SetData const DATATYPE *  copy  )  [inline]
 

copies another vector 'copy'

Definition at line 313 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline DATATYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::SquareLength  )  const
 

calculates the squared length of the vector

Definition at line 492 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.

Referenced by salt::TVector< float, 3, Vector3f >::Length(), oxygen::VelocityController::PrePhysicsUpdateInternal(), oxygen::FPSController::PrePhysicsUpdateInternal(), and DriveEffector::Realize().

template<typename DATATYPE, int ELEMENTS, class TYPE>
f_inline TYPE & salt::TVector< DATATYPE, ELEMENTS, TYPE >::Zero  ) 
 

sets all components of the vector to 0

Definition at line 340 of file tvector.h.

References salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData.


Member Data Documentation

template<typename DATATYPE, int ELEMENTS, typename TYPE>
DATATYPE salt::TVector< DATATYPE, ELEMENTS, TYPE >::mData[ELEMENTS] [private]
 

Definition at line 185 of file tvector.h.

Referenced by salt::TVector< DATATYPE, ELEMENTS, TYPE >::Dot(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::Dump(), salt::TVector< float, 3, Vector3f >::El(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::Fill(), salt::TVector< float, 3, Vector3f >::GetData(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::LinearInterpolate(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::Normalize(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::Normalized(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator *(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator *=(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator+(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator+=(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator-(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator-=(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator/(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::operator/=(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::SetData(), salt::TVector< DATATYPE, ELEMENTS, TYPE >::SquareLength(), salt::TVector< float, 3, Vector3f >::TVector(), and salt::TVector< DATATYPE, ELEMENTS, TYPE >::Zero().


The documentation for this class was generated from the following file:
Generated on Thu Apr 6 15:49:26 2006 for rcssserver3d by  doxygen 1.4.4