Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
Vector< Rows > Class Template Reference

Templatized vector class. More...

#include <Vector.h>

Public Member Functions

 Vector ()=default
 Constructor. More...
 
 Vector (const Vector &)=default
 
uint GetRows () const
 Dimensions. More...
 
void SetZero ()
 Vector with all zeros. More...
 
template<class OtherVector >
void CopyPart (const OtherVector &inV, uint inSourceRow, uint inNumRows, uint inDestRow)
 Copy a (part) of another vector into this vector. More...
 
float operator[] (uint inCoordinate) const
 Get float component by index. More...
 
float & operator[] (uint inCoordinate)
 
bool operator== (const Vector &inV2) const
 Comparison. More...
 
bool operator!= (const Vector &inV2) const
 
bool IsZero () const
 Test if vector consists of all zeros. More...
 
bool IsClose (const Vector &inV2, float inMaxDistSq=1.0e-12f)
 Test if two vectors are close to each other. More...
 
Vectoroperator= (const Vector &)=default
 Assignment. More...
 
Vector operator* (const float inV2) const
 Multiply vector with float. More...
 
Vectoroperator*= (const float inV2)
 
Vector operator/ (float inV2) const
 Divide vector by float. More...
 
Vectoroperator/= (float inV2)
 
Vector operator+ (const Vector &inV2) const
 Add two float vectors (component wise) More...
 
Vectoroperator+= (const Vector &inV2)
 
Vector operator- () const
 Negate. More...
 
Vector operator- (const Vector &inV2) const
 Subtract two float vectors (component wise) More...
 
Vectoroperator-= (const Vector &inV2)
 
float Dot (const Vector &inV2) const
 Dot product. More...
 
float LengthSq () const
 Squared length of vector. More...
 
float Length () const
 Length of vector. More...
 
bool IsNormalized (float inToleranceSq=1.0e-6f)
 Check if vector is normalized. More...
 
Vector Normalized () const
 Normalize vector. More...
 

Static Public Member Functions

static Vector sZero ()
 

Public Attributes

float mF32 [Rows]
 

Friends

Vector operator* (const float inV1, const Vector &inV2)
 Multiply vector with float. More...
 
ostream & operator<< (ostream &inStream, const Vector &inV)
 To String. More...
 

Detailed Description

template<uint Rows>
class Vector< Rows >

Templatized vector class.

Constructor & Destructor Documentation

◆ Vector() [1/2]

template<uint Rows>
Vector< Rows >::Vector ( )
inlinedefault

Constructor.

◆ Vector() [2/2]

template<uint Rows>
Vector< Rows >::Vector ( const Vector< Rows > &  )
inlinedefault

Member Function Documentation

◆ CopyPart()

template<uint Rows>
template<class OtherVector >
void Vector< Rows >::CopyPart ( const OtherVector< Rows > &  inV,
uint  inSourceRow,
uint  inNumRows,
uint  inDestRow 
)
inline

Copy a (part) of another vector into this vector.

◆ Dot()

template<uint Rows>
float Vector< Rows >::Dot ( const Vector< Rows > &  inV2) const
inline

Dot product.

◆ GetRows()

template<uint Rows>
uint Vector< Rows >::GetRows ( ) const
inline

Dimensions.

◆ IsClose()

template<uint Rows>
bool Vector< Rows >::IsClose ( const Vector< Rows > &  inV2,
float  inMaxDistSq = 1.0e-12f 
)
inline

Test if two vectors are close to each other.

◆ IsNormalized()

template<uint Rows>
bool Vector< Rows >::IsNormalized ( float  inToleranceSq = 1.0e-6f)
inline

Check if vector is normalized.

◆ IsZero()

template<uint Rows>
bool Vector< Rows >::IsZero ( ) const
inline

Test if vector consists of all zeros.

◆ Length()

template<uint Rows>
float Vector< Rows >::Length ( ) const
inline

Length of vector.

◆ LengthSq()

template<uint Rows>
float Vector< Rows >::LengthSq ( ) const
inline

Squared length of vector.

◆ Normalized()

template<uint Rows>
Vector Vector< Rows >::Normalized ( ) const
inline

Normalize vector.

◆ operator!=()

template<uint Rows>
bool Vector< Rows >::operator!= ( const Vector< Rows > &  inV2) const
inline

◆ operator*()

template<uint Rows>
Vector Vector< Rows >::operator* ( const float  inV2) const
inline

Multiply vector with float.

◆ operator*=()

template<uint Rows>
Vector & Vector< Rows >::operator*= ( const float  inV2)
inline

◆ operator+()

template<uint Rows>
Vector Vector< Rows >::operator+ ( const Vector< Rows > &  inV2) const
inline

Add two float vectors (component wise)

◆ operator+=()

template<uint Rows>
Vector & Vector< Rows >::operator+= ( const Vector< Rows > &  inV2)
inline

◆ operator-() [1/2]

template<uint Rows>
Vector Vector< Rows >::operator- ( ) const
inline

Negate.

◆ operator-() [2/2]

template<uint Rows>
Vector Vector< Rows >::operator- ( const Vector< Rows > &  inV2) const
inline

Subtract two float vectors (component wise)

◆ operator-=()

template<uint Rows>
Vector & Vector< Rows >::operator-= ( const Vector< Rows > &  inV2)
inline

◆ operator/()

template<uint Rows>
Vector Vector< Rows >::operator/ ( float  inV2) const
inline

Divide vector by float.

◆ operator/=()

template<uint Rows>
Vector & Vector< Rows >::operator/= ( float  inV2)
inline

◆ operator=()

template<uint Rows>
Vector & Vector< Rows >::operator= ( const Vector< Rows > &  )
inlinedefault

Assignment.

◆ operator==()

template<uint Rows>
bool Vector< Rows >::operator== ( const Vector< Rows > &  inV2) const
inline

Comparison.

◆ operator[]() [1/2]

template<uint Rows>
float & Vector< Rows >::operator[] ( uint  inCoordinate)
inline

◆ operator[]() [2/2]

template<uint Rows>
float Vector< Rows >::operator[] ( uint  inCoordinate) const
inline

Get float component by index.

◆ SetZero()

template<uint Rows>
void Vector< Rows >::SetZero ( )
inline

Vector with all zeros.

◆ sZero()

template<uint Rows>
static Vector Vector< Rows >::sZero ( )
inlinestatic

Friends And Related Function Documentation

◆ operator*

template<uint Rows>
Vector operator* ( const float  inV1,
const Vector< Rows > &  inV2 
)
friend

Multiply vector with float.

◆ operator<<

template<uint Rows>
ostream & operator<< ( ostream &  inStream,
const Vector< Rows > &  inV 
)
friend

To String.

Member Data Documentation

◆ mF32

template<uint Rows>
float Vector< Rows >::mF32[Rows]

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