ASL
Loading...
Searching...
No Matches
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();
An Array is a contiguous and resizable array of any type of elements.
Definition Array.h:69

#include <Vec4.h>

Public Member Functions

Vec3_< Txyz () const
 Returns the x, y, z components as a Vec3.
 
Vec3_< Th2c () const
 Returns the cartesian coordinates vector corresponding to this homogenous coordinates.
 
Vec4_ normalized () const
 Returns a normalized version of this vector.
 
T length () const
 Returns the length of the vector.
 
T length2 () const
 Returns the length of the vector squared.
 
T 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
 
T 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

T 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: