In file include/csgeom/math3d.h:

class csVector3

A 3D vector

Inheritance:


Public Fields

float x
float y
float z

Public Methods

csVector3(float m)
Make a new initialized vector
csVector3(float x, float y, float z = 0)
Make a new vector and initialize with the given values.
csVector3()
Make a new vector
float Norm()
Returns the norm of this vector.
inline static float Norm(const csVector3& v)
Returns the norm (magnitude) of a vector.
inline friend bool operator!= (const csVector3& v1, const csVector3& v2)
Check if two vectors are not equal.
inline friend csVector3 operator% (const csVector3& v1, const csVector3& v2)
Take the cross product of two vectors.
inline friend csVector3 operator* (const csVector3& v, float f)
Multiply a vector and a scalar.
inline friend float operator* (const csVector3& v1, const csVector3& v2)
Take the dot product of two vectors.
inline friend csVector3 operator* (float f, const csVector3& v)
Multiply a vector and a scalar.
inline csVector3& operator*= (float f)
Multiply this vector by a scalar.
inline friend csVector3 operator+ (const csVector3& v1, const csVector3& v2)
Add two vectors.
inline csVector3 operator+ ()
Unary + operator.
inline csVector3& operator+= (const csVector3& v)
Add another vector to this vector.
inline csVector3 operator- ()
Unary - operator.
inline friend csVector3 operator- (const csVector3& v1, const csVector3& v2)
Subtract two vectors.
inline csVector3& operator-= (const csVector3& v)
Subtract another vector from this vector.
inline friend csVector3 operator/ (const csVector3& v, float f)
Divide a vector by a scalar.
inline csVector3& operator/= (float f)
Divide this vector by a scalar.
inline friend bool operator< (const csVector3& v, float f)
Test if each component of a vector is less than a small epsilon value.
inline friend csVector3 operator<< (const csVector3& v1, const csVector3& v2)
Project one vector onto another.
inline friend bool operator== (const csVector3& v1, const csVector3& v2)
Check if two vectors are equal.
inline friend bool operator> (float f, const csVector3& v)
Test if each component of a vector is greater than a small epsilon value.
inline friend csVector3 operator>> (const csVector3& v1, const csVector3& v2)
Project one vector onto another.
inline float operator[](int n)
Returns n-th component of the vector
inline void Set(float sx, float sy, float sz)
Set the value of this vector.
csVector3 Unit()
Returns the unit vector in the direction of this vector

Documentation

A 3D vector
float x

float y

float z

csVector3()
Make a new vector. The vector is not initialized. This makes the code slightly faster as csVector3 objects are used a lot.

csVector3(float m)
Make a new initialized vector. Creates a new vector and initializes it to m*<1,1,1>. To create a vector initialized to the zero vector, use csVector3(0)

csVector3(float x, float y, float z = 0)
Make a new vector and initialize with the given values.

inline friend csVector3 operator+ (const csVector3& v1, const csVector3& v2)
Add two vectors.

inline friend csVector3 operator- (const csVector3& v1, const csVector3& v2)
Subtract two vectors.

inline friend float operator* (const csVector3& v1, const csVector3& v2)
Take the dot product of two vectors.

inline friend csVector3 operator% (const csVector3& v1, const csVector3& v2)
Take the cross product of two vectors.

inline friend csVector3 operator* (const csVector3& v, float f)
Multiply a vector and a scalar.

inline friend csVector3 operator* (float f, const csVector3& v)
Multiply a vector and a scalar.

inline friend csVector3 operator/ (const csVector3& v, float f)
Divide a vector by a scalar.

inline friend bool operator== (const csVector3& v1, const csVector3& v2)
Check if two vectors are equal.

inline friend bool operator!= (const csVector3& v1, const csVector3& v2)
Check if two vectors are not equal.

inline friend csVector3 operator>> (const csVector3& v1, const csVector3& v2)
Project one vector onto another.

inline friend csVector3 operator<< (const csVector3& v1, const csVector3& v2)
Project one vector onto another.

inline friend bool operator< (const csVector3& v, float f)
Test if each component of a vector is less than a small epsilon value.

inline friend bool operator> (float f, const csVector3& v)
Test if each component of a vector is greater than a small epsilon value.

inline float operator[](int n)
Returns n-th component of the vector

inline csVector3& operator+= (const csVector3& v)
Add another vector to this vector.

inline csVector3& operator-= (const csVector3& v)
Subtract another vector from this vector.

inline csVector3& operator*= (float f)
Multiply this vector by a scalar.

inline csVector3& operator/= (float f)
Divide this vector by a scalar.

inline csVector3 operator+ ()
Unary + operator.

inline csVector3 operator- ()
Unary - operator.

inline void Set(float sx, float sy, float sz)
Set the value of this vector.

float Norm()
Returns the norm of this vector.

csVector3 Unit()
Returns the unit vector in the direction of this vector. Attempting to normalize a zero-vector will result in a divide by zero error. This is as it should be... fix the calling code.

inline static float Norm(const csVector3& v)
Returns the norm (magnitude) of a vector.


Direct child classes:
mz3DVertex

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de