Ocular Engine
Ocular::Math::Vector4< T > Class Template Reference
Inheritance diagram for Ocular::Math::Vector4< T >:
Ocular::Core::Color

Public Member Functions

 Vector4 (T const *values)
 
 Vector4 (Vector3< T > const &vec, T pW=static_cast< T >(1.0f))
 
 Vector4 (T const &pX, T const &pY, T const &pZ, T const &pW)
 
T & operator[] (unsigned const &index)
 
operator[] (unsigned const &index) const
 
Vector4< T > operator- ()
 
Vector4< T > & operator= (Vector4< T > const &rhs)
 
Vector4< T > & operator= (Vector3< T > const &rhs)
 
Vector4< T > & operator+= (Vector4< T > const &rhs)
 
Vector4< T > & operator+= (T const &rhs)
 
Vector4< T > & operator-= (Vector4< T > const &rhs)
 
Vector4< T > & operator-= (T const &rhs)
 
Vector4< T > & operator*= (Vector4< T > const &rhs)
 
Vector4< T > & operator*= (T const &rhs)
 
Vector4< T > & operator/= (Vector4< T > const &rhs)
 
Vector4< T > & operator/= (T const &rhs)
 
Vector2< T > xy () const
 
Vector3< T > xyz () const
 
getMagnitude () const
 
getLength () const
 
void normalize ()
 
Vector4< T > getNormalized () const
 
dot (Vector4< T > const &rhs) const
 
angleBetween (Vector4< T > const &rhs) const
 
distanceTo (Vector4< T > const &rhs) const
 
void homogenize ()
 

Static Public Member Functions

static Vector4< T > Midpoint (Vector4< T > const &a, Vector4< T > const &b)
 

Public Attributes

union {
   T   x
 
   T   r
 
   T   u
 
   T   s
 
}; 
 
union {
   T   y
 
   T   g
 
   T   v
 
   T   t
 
}; 
 
union {
   T   z
 
   T   b
 
   T   p
 
}; 
 
union {
   T   w
 
   T   a
 
   T   q
 
}; 
 

Static Public Attributes

static bool OCULAR_INTERNAL_Force = false
 

Member Function Documentation

template<typename T>
T Ocular::Math::Vector4< T >::angleBetween ( Vector4< T > const &  rhs) const
inline

This is equivalent to taking the acos of the dot product.
The returned angle is the acute angle, i.e the smallest of the two angles.

Parameters
[in]rhsThe second vector to calculate the angle with
Returns
The angle, in radians, between the vectors
template<typename T>
T Ocular::Math::Vector4< T >::distanceTo ( Vector4< T > const &  rhs) const
inline
Parameters
[in]rhsThe second vector to calculate the distance with
Returns
The distance between the two vectors
template<typename T>
T Ocular::Math::Vector4< T >::dot ( Vector4< T > const &  rhs) const
inline

The dot product is a value equal to the magnitudes of the two vectors multiplied together and then multiplied by the cosine of the angle between them.

Parameters
[in]rhsThe second vector dot multiply with
Returns
The dot product of the two vectors (in radians)
template<typename T>
T Ocular::Math::Vector4< T >::getLength ( ) const
inline
Returns
The length of the vector.
template<typename T>
T Ocular::Math::Vector4< T >::getMagnitude ( ) const
inline
Returns
The magnitude (length) of the vector.
template<typename T>
Vector4<T> Ocular::Math::Vector4< T >::getNormalized ( ) const
inline

Returns the normalized form of this vector

template<typename T>
void Ocular::Math::Vector4< T >::homogenize ( )
inline

Homegenizes the vector (divides all components by w so that w == 1)

template<typename T>
static Vector4<T> Ocular::Math::Vector4< T >::Midpoint ( Vector4< T > const &  a,
Vector4< T > const &  b 
)
inlinestatic

Calculates the midpoint of the two provided points.

Parameters
[in]a
[in]b
Returns
The midpoint vector
template<typename T>
void Ocular::Math::Vector4< T >::normalize ( )
inline

Normalizes the vector. When normalized, a vector maintains its direction but its magnitude is set to 1.0.


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