fluidvis
Public Member Functions | Public Attributes | Friends | List of all members
sx::Vector Class Reference

#include <SXMath.h>

Inheritance diagram for sx::Vector:
sx::UniformVector

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 Vectoroperator= (const Vector &v)
 
virtual EXPA ~Vector ()
 
EXPA float & operator[] (unsigned int index)
 
EXPA float operator[] (unsigned int index) const
 
EXPA Vectoroperator<< (const Vector &v)
 
EXPA Vectoroperator<< (const float *v)
 
EXPA const Vectoroperator>> (Vector &v) const
 
EXPA const Vectoroperator>> (float *v) const
 
EXPA Vectoradd (const Vector &v)
 
EXPA Vectoradd (float x)
 
EXPA Vectorcrossmult (const Vector &v)
 
EXPA Vectorscalarmult (float s)
 
EXPA float innerprod (const Vector &v) const
 
EXPA Vectorleftmult (const Matrix &m)
 
EXPA Vectorrightmult (const Matrix &m)
 
EXPA Vectornormalize ()
 
EXPA float distance (const Vector &v) const
 
EXPA float length () const
 
EXPA Vectorrandom ()
 
EXPA Vectorhomogenize ()
 
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)
 

Detailed Description

A Vector in four-dimensional homogenous space

Constructor & Destructor Documentation

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 EXPA sx::Vector::~Vector ( )
virtual

deconstructor

Member Function Documentation

EXPA Vector& sx::Vector::add ( const Vector v)

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

EXPA Vector& sx::Vector::crossmult ( const Vector v)

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 Vector& sx::Vector::leftmult ( const Matrix m)

stores m * this[0] in this

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.

EXPA Vector& sx::Vector::operator<< ( const Vector v)

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.

EXPA Vector& sx::Vector::operator= ( const Vector v)

assignment operator

EXPA const Vector& sx::Vector::operator>> ( Vector v) const

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.

Parameters
indexnumber of the component
returnreference to the index. component
exceptionthrows 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.

Parameters
indexnumber of the component
returnreference to the index. component
exceptionthrows 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::rightmult ( const Matrix m)

stores this[0] * m in this

EXPA Vector& sx::Vector::scalarmult ( float  s)

multiplies this with s, leaves w untouched, and returns a reference to this

Friends And Related Function Documentation

EXPA friend Vector operator% ( const Vector v1,
const Vector v2 
)
friend

returns the crossproduct of v1 and v2 with w=1

EXPA friend Vector operator* ( const Vector v,
float  x 
)
friend

returns the scalarproduct of v and x and copies w of v into the returned vector

EXPA friend Vector operator* ( float  x,
const Vector v 
)
friend

returns the scalarproduct of v and x and copies w of v into the returned vector

EXPA friend float operator* ( const Vector v1,
const Vector v2 
)
friend

returns the inner product of the first three components of v1 and v2

EXPA friend Vector operator* ( const Matrix m,
const Vector v 
)
friend

returns m * v

EXPA friend Vector operator* ( const Vector v,
const Matrix m 
)
friend

returns v * m

EXPA friend Vector operator+ ( const Vector v1,
const Vector v2 
)
friend

returns the sum of v1 and v2 with w=1

EXPA friend Vector operator+ ( const Vector v,
float  x 
)
friend

returns the sum of v and (x,x,x,1) with w=1

EXPA friend Vector operator+ ( float  x,
const Vector v 
)
friend

returns the sum of v and (x,x,x,1) with w=1

EXPA friend Vector operator-- ( const Vector v)
friend

returns the scalarproduct of v with -1 and copies w of v into the returned vector

Member Data Documentation

float* sx::Vector::elements

components of vector, has always four components x,y,z,w


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