Proud::Vector3T< FloatType > Struct Template Reference

Public Member Functions

 Vector3T (const FloatType *from)
 
 Vector3T (FloatType x, FloatType y, FloatType z)
 
 operator FloatType * ()
 
 operator const FloatType * () const
 
template<typename D3DXVECTOR3 >
__forceinline Vector3T (const D3DXVECTOR3 &from)
 
template<typename D3DXVECTOR3 >
__forceinline operator D3DXVECTOR3 const ()
 
Vector3Toperator+= (const Vector3T &src)
 
Vector3Toperator-= (const Vector3T &src)
 
Vector3Toperator*= (FloatType scale)
 
Vector3Toperator/= (FloatType scale)
 
Vector3T operator+ () const
 
Vector3T operator- () const
 
Vector3T operator+ (const Vector3T &src) const
 
Vector3T operator- (const Vector3T &src) const
 
Vector3T operator* (FloatType scale) const
 
Vector3T operator/ (FloatType scale) const
 
bool operator== (const Vector3T &rhs) const
 
bool operator!= (const Vector3T &rhs) const
 
 __declspec (property(get=GetLengthSq)) FloatType LengthSq
 
 __declspec (property(get=GetLength)) FloatType Length
 
Vector3T GetNormal () const
 
FloatType GetLengthSq () const
 
FloatType GetLength () const
 
FloatType Distance (const Vector3T &a) const
 
FloatType Distance2 (const Vector3T &a) const
 
void SetLength (FloatType length)
 

Static Public Member Functions

static Vector3T Lerp (const Vector3T &a, const Vector3T &b, FloatType ratio)
 
static FloatType Dot (const Vector3T &a, const Vector3T &b)
 

Public Attributes

FloatType x
 x
 
FloatType y
 y
 
FloatType z
 z
 

Detailed Description

template<typename FloatType>
struct Proud::Vector3T< FloatType >

Vector 3D Class

  • The purpose of this class is to avoid platform depedence even though Vector 3 already exists.
  • To increase the accuracy(i.e. Online game with the outer space backgroundw), FloatType is used. If you require the lower specification then we suggest to use a different object type rather than Vector 3.
  • This module supports arithmetic operators thus it's possible to code as shown in below.
Vector3T a = Vector3T(1,2,3);
Vector3T b = Vector3T(4,5,6);
Vector3T c = (a * b) + c - d;

Member Function Documentation

template<typename FloatType >
static FloatType Proud::Vector3T< FloatType >::Dot ( const Vector3T< FloatType > &  a,
const Vector3T< FloatType > &  b 
)
inlinestatic

Calculate the interval of two vectors

template<typename FloatType >
FloatType Proud::Vector3T< FloatType >::GetLength ( ) const
inline

Length of the vector

template<typename FloatType >
FloatType Proud::Vector3T< FloatType >::GetLengthSq ( ) const
inline

Calculate the square value of the length.

template<typename FloatType >
Vector3T Proud::Vector3T< FloatType >::GetNormal ( ) const
inline

Calculates the normal vector.

template<typename FloatType >
static Vector3T Proud::Vector3T< FloatType >::Lerp ( const Vector3T< FloatType > &  a,
const Vector3T< FloatType > &  b,
FloatType  ratio 
)
inlinestatic

Interpolate two vectors.

  • a + (b - a) * ratio
template<typename FloatType >
void Proud::Vector3T< FloatType >::SetLength ( FloatType  length)
inline

Sets the length of the vector to a specified length without changing the orientation.