ASL
Vec4_< T > Class Template Reference

Detailed Description

template<class T>
class asl::Vec4_< T >

A Vec4 is a 4-dimensional vector usually representing homogenous coordinates.

It can be used together with class Matrix4 to transform vectors in projective space.

Vec4 a (10, 10, 0.1, 1.0);
Vec3 v = a.h2c();

#include <Vec4.h>

Public Member Functions

Vec3_< T > xyz () const
 Returns the x, y, z components as a Vec3.
 
Vec3_< T > h2c () const
 Returns the cartesian coordinates vector corresponding to this homogenous coordinates.
 
Vec4_ normalized () const
 Returns a normalized version of this vector.
 
length () const
 Returns the length of the vector.
 
length2 () const
 Returns the length of the vector squared.
 
operator! () const
 Returns the length of the vector.
 
Vec4_ operator+ (const Vec4_ &b) const
 Returns this plus b
 
Vec4_ operator- (const Vec4_ &b) const
 Returns this minus b
 
operator* (const Vec4_ &b) const
 Returns the dot product of this vector and b
 
Vec4_ operator* (T r) const
 Returns this vector multiplied by scalar r
 
Vec4_ operator/ (T r) const
 Returns this vector divided by scalar r
 
Vec4_ operator% (const Vec4_ &b) const
 Returns a vector that is a component-wise product of this vector and b
 
bool operator== (const Vec4_ &b) const
 Checks if this vector is equal to b
 
bool operator!= (const Vec4_ &b) const
 Checks if this vector is not equal to b
 
void operator+= (const Vec4_ &b)
 Adds vector b to this vector.
 
void operator-= (const Vec4_ &b)
 Subtracts vector b from this vector.
 
void operator*= (T r)
 Multiplies this vector by scalar r
 
void operator/= (T r)
 Divides this vector by scalar r
 
void operator%= (const Vec4_ &b)
 Multiplies this vector by another, component-wise.
 
Vec4_ operator- () const
 Returns this vector negated.
 

Public Attributes

x
 The x, y, z, w components.
 

Friends

Vec4_ operator* (T r, const Vec4_ &b)
 Returns this vector multiplied by scalar r
 

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