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

#include <SXMath.h>

Inheritance diagram for sx::DVector:
sx::UniformDVector

Public Member Functions

EXPA DVector ()
 
EXPA DVector (double v)
 
EXPA DVector (double x, double y)
 
EXPA DVector (double x, double y, double z)
 
EXPA DVector (double x, double y, double z, double w)
 
EXPA DVector (const double *v)
 
EXPA DVector (const Vector &vector)
 
EXPA DVector (const DVector &vector)
 
EXPA DVectoroperator= (const DVector &v)
 
virtual EXPA ~DVector ()
 
EXPA double & operator[] (unsigned int index)
 
EXPA double operator[] (unsigned int index) const
 
EXPA DVectoroperator<< (const DVector &v)
 
EXPA DVectoroperator<< (const double *v)
 
EXPA const DVectoroperator>> (DVector &v) const
 
EXPA const DVectoroperator>> (double *v) const
 
EXPA DVectoradd (const DVector &v)
 
EXPA DVectoradd (double x)
 
EXPA DVectorcrossmult (const DVector &v)
 
EXPA DVectorscalarmult (double s)
 
EXPA double innerprod (const DVector &v) const
 
EXPA DVectorleftmult (const DMatrix &m)
 
EXPA DVectorrightmult (const DMatrix &m)
 
EXPA DVectornormalize ()
 
EXPA double distance (const DVector &v) const
 
EXPA double length () const
 
EXPA DVectorrandom ()
 
EXPA DVectorhomogenize ()
 
EXPA bool equals (const DVector &v) const
 
EXPA bool equals (const DVector &v, double epsilon) const
 

Public Attributes

double * elements
 

Friends

EXPA friend DVector operator+ (const DVector &v1, const DVector &v2)
 
EXPA friend DVector operator+ (const DVector &v, double x)
 
EXPA friend DVector operator+ (double x, const DVector &v)
 
EXPA friend DVector operator% (const DVector &v1, const DVector &v2)
 
EXPA friend DVector operator* (const DVector &v, double x)
 
EXPA friend DVector operator* (double x, const DVector &v)
 
EXPA friend DVector operator-- (const DVector &v)
 
EXPA friend double operator* (const DVector &v1, const DVector &v2)
 
EXPA friend DVector operator* (const DMatrix &m, const DVector &v)
 
EXPA friend DVector operator* (const DVector &v, const DMatrix &m)
 

Detailed Description

A double precision Vector in four-dimensional homogenous space

Constructor & Destructor Documentation

EXPA sx::DVector::DVector ( )

default constructor, constructs a zero vector with w=1

EXPA sx::DVector::DVector ( double  v)

constructor, initializes x,y,z with v and w=1

EXPA sx::DVector::DVector ( double  x,
double  y 
)

constructor, initializes the vector with (x,y,0,1)

EXPA sx::DVector::DVector ( double  x,
double  y,
double  z 
)

constructor, initializes the vector with (x,y,z,1)

EXPA sx::DVector::DVector ( double  x,
double  y,
double  z,
double  w 
)

constructor, initializes the vector with (x,y,z,w)

EXPA sx::DVector::DVector ( const double *  v)

Constructor, copies array v into elements. v must have at least length 4.

EXPA sx::DVector::DVector ( const Vector vector)

constructor for casting

EXPA sx::DVector::DVector ( const DVector vector)

copy constructor

virtual EXPA sx::DVector::~DVector ( )
virtual

deconstructor

Member Function Documentation

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

adds vector v to this vector, leaves w untouched, and returns a reference to this

EXPA DVector& sx::DVector::add ( double  x)

add vector (x,x,x,1) to this vector, leaves w untouched, and returns a reference to this

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

stores the crossproduct of this and v in this, leaves w untouched, and returns a reference to this

EXPA double sx::DVector::distance ( const DVector v) const

returns the distance of the points specified by the first three components of this and v

EXPA bool sx::DVector::equals ( const DVector v) const

returns true iff all components of this and v are equal

EXPA bool sx::DVector::equals ( const DVector v,
double  epsilon 
) const

returns true iff the difference of each component of this and v is not larger than epsilon

EXPA DVector& sx::DVector::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 double sx::DVector::innerprod ( const DVector v) const

returns the inner product of the first three components of this and v

EXPA DVector& sx::DVector::leftmult ( const DMatrix m)

stores m * this[0] in this

EXPA double sx::DVector::length ( ) const

returns the length of (x,y,z)

EXPA DVector& sx::DVector::normalize ( )

Normalizes this leaving w untouched, and taking only the components x, y, z into consideration, and returns a reference to this.

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

copies vector v, and returns a reference to this

EXPA DVector& sx::DVector::operator<< ( const double *  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 DVector& sx::DVector::operator= ( const DVector v)

assignment operator

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

copies itself to vector v, returns a reference to this

EXPA const DVector& sx::DVector::operator>> ( double *  v) const

Copies itself to array v. The length of array v must be at least 4. Returns a reference to this.

EXPA double& sx::DVector::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 double sx::DVector::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 DVector& sx::DVector::random ( )

assigns (x,y,z) with a random value out of [0,1]^3, sets w=1, and returns a reference to this

EXPA DVector& sx::DVector::rightmult ( const DMatrix m)

stores this[0] * m in this

EXPA DVector& sx::DVector::scalarmult ( double  s)

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

Friends And Related Function Documentation

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

returns the crossproduct of v1 and v2 with w=1

EXPA friend DVector operator* ( const DVector v,
double  x 
)
friend

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

EXPA friend DVector operator* ( double  x,
const DVector v 
)
friend

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

EXPA friend double operator* ( const DVector v1,
const DVector v2 
)
friend

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

EXPA friend DVector operator* ( const DMatrix m,
const DVector v 
)
friend

returns m * v

EXPA friend DVector operator* ( const DVector v,
const DMatrix m 
)
friend

returns v * m

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

returns the sum of v1 and v2 with w=1

EXPA friend DVector operator+ ( const DVector v,
double  x 
)
friend

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

EXPA friend DVector operator+ ( double  x,
const DVector v 
)
friend

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

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

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

Member Data Documentation

double* sx::DVector::elements

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


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