Make your own free website on

Contents Turbed: A Turbulent Behavior Development System News
In file vector4.hpp:

class Vector

Affine and math 4 row vector

Public Fields

ofloat v[4]
Vector data

Public Methods

o Vector()
Default constructor vector affine cero = [ 0,0,0,1]
o Vector(Vector &nv)
Copy constructor
ofloat normalize()
Normalize the vector vec*=1/mag, mag ! incl 4 coord.
ofloat mag()
Vector magnitude = mag vector R3
ovoid setVector(Vector &nv)
copie vector data from another one.
ovoid setVectorData(float *nv)
set the vector values from an array
ovoid setVectorCero()
set the vector to cero (invalid vector) = [0,0,0,0]
ovoid setVectorAffineCero()
set vector = [0,0,0,1]
ovoid operator=(float d)
set vector to [d,d,d]
ovoid operator=(Vector &nv)
copy operator
oint operator==(Vector &nv)
see if two vector are the same (assume 4th comp =1)
oint operator>(Vector &nv)
vector greater than
oint operator>=(Vector &nv)
greater equal
oint operator<(Vector &nv)
oint operator<=(Vector &nv)
less equal
oVector& operator+(Vector &nv)
vector addition (overwrite this vec. values with answer)
oVector& operator-(Vector &nv)
vector substraction (overwrite this vec. values with answer)
ofloat operator[](const unsigned int i)
get the specified ordinate
ovoid setVectorData(float x, float y, float z, float w=1)
set the data individually
ovoid addScalar(float t)
add scalar to vector
ovoid addVector(Vector& v2)
add two vectors answ. overwrite this
ovoid addVector(Vector v1, Vector v2, Vector &vo)
add two vector, return answ. in a new one.
ovoid addVector(Vector nv, Vector &vo)
add vector to this, return answ. in a new one.
ovoid addVectorData(float nv[4], float vs[4])
add two vector arrays, 4th coord. = 1
ovoid subVector(Vector& v2)
substracts two vectors
ovoid subVectorData(float nv[4], float vs[4])
substracts two vector arrays, 4th coord. = 1
ovoid scaleVector(float s)
scale vector by an scalar
ofloat dotProd(Vector &v2)
Dot product
ofloat dotProd(Vector &v1, Vector &v2)
Dot Product
ofloat dotProdData(float *v2)
dot product of two vector arrays
ovoid crossProd(Vector &v2, Vector &vo)
Cross product
ovoid crossProd(Vector &v1, Vector &v2, Vector &vo)
Cross product
ovoid crossProdData(float w[4], float vs[4])
Cross product of two vector arrays
ovoid Print()
print this vector to stdout
ovoid vecAbs()
Absulte value for each of the coord, of this vector
ofloat dist(Vector &v1, Vector &v2)
calculate distance between two points (vector mag)
ofloat dist(Vector &v2)
calculate distance between two points (vector mag)
o ~Vector()
Class destructor cleans memory, etc..


Affine and math 4 row vector.

Simple 4 float component vector class, affine vector and normal math vector types represented.

to be used alone or in conbination of the 4x4 matrix class

This class has no child classes.
Daniel Barrero
See Also:

Alphabetic index HTML hierarchy of classes or Java

This software was originally written by Daniel Barrero at the IRIT's Equipe Synthèse d'Images

Generated by doc++