fluidvis
|
#include <SXMath.h>
Public Member Functions | |
EXPA | Vector () |
EXPA | Vector (float v) |
EXPA | Vector (float x, float y) |
EXPA | Vector (float x, float y, float z) |
EXPA | Vector (float x, float y, float z, float w) |
EXPA | Vector (const float *v) |
EXPA | Vector (const DVector &vector) |
EXPA | Vector (const Vector &vector) |
EXPA Vector & | operator= (const Vector &v) |
virtual EXPA | ~Vector () |
EXPA float & | operator[] (unsigned int index) |
EXPA float | operator[] (unsigned int index) const |
EXPA Vector & | operator<< (const Vector &v) |
EXPA Vector & | operator<< (const float *v) |
EXPA const Vector & | operator>> (Vector &v) const |
EXPA const Vector & | operator>> (float *v) const |
EXPA Vector & | add (const Vector &v) |
EXPA Vector & | add (float x) |
EXPA Vector & | crossmult (const Vector &v) |
EXPA Vector & | scalarmult (float s) |
EXPA float | innerprod (const Vector &v) const |
EXPA Vector & | leftmult (const Matrix &m) |
EXPA Vector & | rightmult (const Matrix &m) |
EXPA Vector & | normalize () |
EXPA float | distance (const Vector &v) const |
EXPA float | length () const |
EXPA Vector & | random () |
EXPA Vector & | homogenize () |
EXPA bool | equals (const Vector &v) const |
EXPA bool | equals (const Vector &v, float epsilon) const |
Public Attributes | |
float * | elements |
Friends | |
EXPA friend Vector | operator+ (const Vector &v1, const Vector &v2) |
EXPA friend Vector | operator+ (const Vector &v, float x) |
EXPA friend Vector | operator+ (float x, const Vector &v) |
EXPA friend Vector | operator% (const Vector &v1, const Vector &v2) |
EXPA friend Vector | operator* (const Vector &v, float x) |
EXPA friend Vector | operator* (float x, const Vector &v) |
EXPA friend Vector | operator-- (const Vector &v) |
EXPA friend float | operator* (const Vector &v1, const Vector &v2) |
EXPA friend Vector | operator* (const Matrix &m, const Vector &v) |
EXPA friend Vector | operator* (const Vector &v, const Matrix &m) |
A Vector in four-dimensional homogenous space
EXPA sx::Vector::Vector | ( | ) |
default constructor, constructs a zero vector with w=1
EXPA sx::Vector::Vector | ( | float | v | ) |
constructor, initializes x,y,z with v and w=1
EXPA sx::Vector::Vector | ( | float | x, |
float | y | ||
) |
constructor, initializes the vector with (x,y,0,1)
EXPA sx::Vector::Vector | ( | float | x, |
float | y, | ||
float | z | ||
) |
constructor, initializes the vector with (x,y,z,1)
EXPA sx::Vector::Vector | ( | float | x, |
float | y, | ||
float | z, | ||
float | w | ||
) |
constructor, initializes the vector with (x,y,z,w)
EXPA sx::Vector::Vector | ( | const float * | v | ) |
Constructor, copies array v into elements. v must have at least length 4.
EXPA sx::Vector::Vector | ( | const DVector & | vector | ) |
constructor for casting
EXPA sx::Vector::Vector | ( | const Vector & | vector | ) |
copy constructor
|
virtual |
deconstructor
adds vector v to this vector, leaves w untouched, and returns a reference to this
EXPA Vector& sx::Vector::add | ( | float | x | ) |
add vector (x,x,x,1) to this vector, leaves w untouched, and returns a reference to this
stores the crossproduct of this and v in this, leaves w untouched, and returns a reference to this
EXPA float sx::Vector::distance | ( | const Vector & | v | ) | const |
returns the distance of the points specified by the first three components of this and v
EXPA bool sx::Vector::equals | ( | const Vector & | v | ) | const |
returns true iff all components of this and v are equal
EXPA bool sx::Vector::equals | ( | const Vector & | v, |
float | epsilon | ||
) | const |
returns true iff the difference of each component of this and v is not larger than epsilon
EXPA Vector& sx::Vector::homogenize | ( | ) |
Homogenizes the vector by dividing x, y, z, w by w, and returns a reference to this. If w is equal to zero, the method does not modify this.
EXPA float sx::Vector::innerprod | ( | const Vector & | v | ) | const |
returns the inner product of the first three components of this and v
EXPA float sx::Vector::length | ( | ) | const |
returns the length of (x,y,z)
EXPA Vector& sx::Vector::normalize | ( | ) |
Normalizes this leaving w untouched, and taking only the components x, y, z into consideration, and returns a reference to this.
copies vector v, and returns a reference to this
EXPA Vector& sx::Vector::operator<< | ( | const float * | v | ) |
Copies array v, and returns a reference to this. The length of array v must be at least 4. Returns a reference to this.
copies itself to vector v, returns a reference to this
EXPA const Vector& sx::Vector::operator>> | ( | float * | v | ) | const |
Copies itself to array v. The length of array v must be at least 4. Returns a reference to this.
EXPA float& sx::Vector::operator[] | ( | unsigned int | index | ) |
Returns a reference to the index. component. If index is out of bounds, an exception is thrown.
index | number of the component |
return | reference to the index. component |
exception | throws an exception Exception of type EX_BOUNDS, if index is equal to 4 or above |
EXPA float sx::Vector::operator[] | ( | unsigned int | index | ) | const |
Returns a reference to the index. component. If index is out of bounds, an exception is thrown.
index | number of the component |
return | reference to the index. component |
exception | throws an exception Exception of type EX_BOUNDS, if index is equal to 4 or above |
EXPA Vector& sx::Vector::random | ( | ) |
assigns (x,y,z) with a random value out of [0,1]^3, sets w=1, and returns a reference to this
EXPA Vector& sx::Vector::scalarmult | ( | float | s | ) |
multiplies this with s, leaves w untouched, and returns a reference to this
returns the crossproduct of v1 and v2 with w=1
returns the scalarproduct of v and x and copies w of v into the returned vector
returns the scalarproduct of v and x and copies w of v into the returned vector
returns the inner product of the first three components of v1 and v2
returns the sum of v1 and v2 with w=1
returns the sum of v and (x,x,x,1) with w=1
returns the sum of v and (x,x,x,1) with w=1
returns the scalarproduct of v with -1 and copies w of v into the returned vector
float* sx::Vector::elements |
components of vector, has always four components x,y,z,w