- Cal3D 0.9 API Reference -

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

CalVector Class Reference

The vector class. More...

#include <vector.h>

List of all members.

Public Methods

 CalVector ()
 Constructs the vector instance. More...

 CalVector (const CalVector &v)
 Constructs the vector instance. More...

 CalVector (float vx, float vy, float vz)
 Constructs the vector instance. More...

 ~CalVector ()
 Destructs the vector instance. More...

float & operator[] (unsigned int i)
 Provides access to the components of the vector instance. More...

const float & operator[] (unsigned int i) const
 Provides access to the components of the vector instance. More...

void operator= (const CalVector &v)
 Equates the vector instance with another vector. More...

void operator+= (const CalVector &v)
 Adds another vector to the vector instance. More...

void operator-= (const CalVector &v)
 Subtracts another vector from the vector instance. More...

void operator *= (const float d)
 Scales the vector instance. More...

void operator *= (const CalQuaternion &q)
 Transforms the vector instance by a quaternion. More...

void operator *= (const CalMatrix &m)
 Transforms the vector instance by a matrix. More...

void operator/= (const float d)
 Scales the vector instance. More...

bool operator== (const CalVector &v)
 Tests the equality of 2 vectors. More...

void blend (float d, const CalVector &v)
 Interpolates the vector instance to another vector. More...

void clear ()
 Clears the vector instance. More...

float length ()
 Returns the length of the vector instance. More...

float normalize ()
 Normalizes the vector instance. More...

void set (float vx, float vy, float vz)
 Sets new values. More...


Public Attributes

float x
float y
float z

Friends

CAL3D_API CalVector operator+ (const CalVector &v, const CalVector &u)
 Calculates the sum of two vectors. More...

CAL3D_API CalVector operator- (const CalVector &v, const CalVector &u)
 Calculates the difference of two vectors. More...

CAL3D_API CalVector operator * (const CalVector &v, const float d)
 Calculates a scaled vector. More...

CAL3D_API CalVector operator * (const float d, const CalVector &v)
 Calculates a scaled vector. More...

CAL3D_API CalVector operator/ (const CalVector &v, const float d)
 Calculates a scaled vector. More...

CAL3D_API float operator * (const CalVector &v, const CalVector &u)
 Calculates the dot product of two vectors. More...

CAL3D_API CalVector operator% (const CalVector &v, const CalVector &u)
 Calculates the vector product of two vectors. More...


Detailed Description

The vector class.


Constructor & Destructor Documentation

CalVector::CalVector  
 

Constructs the vector instance.

This function is the default constructor of the vector instance.

CalVector::CalVector const CalVector &    v
 

Constructs the vector instance.

This function is a constructor of the vector instance.

Parameters:
v  The vector to construct this vector instance from.

CalVector::CalVector float    vx,
float    vy,
float    vz
 

Constructs the vector instance.

This function is a constructor of the vector instance.

Parameters:
vx  The x component.
vy  The y component.
vz  The z component.

CalVector::~CalVector  
 

Destructs the vector instance.

This function is the destructor of the vector instance.


Member Function Documentation

void CalVector::blend float    d,
const CalVector &    v
 

Interpolates the vector instance to another vector.

This function interpolates the vector instance to another vector by a given factor.

Parameters:
d  The blending factor in the range [0.0, 1.0].
v  The vector to be interpolated to.

void CalVector::clear  
 

Clears the vector instance.

This function clears the vector instance.

float CalVector::length  
 

Returns the length of the vector instance.

This function returns the length of the vector instance.

Returns:
The length of the vector instance.

float CalVector::normalize  
 

Normalizes the vector instance.

This function normalizes the vector instance and returns its former length.

Returns:
The length of the vector instance before normalizing.

void CalVector::operator *= const CalMatrix   m
 

Transforms the vector instance by a matrix.

This function transforms the vector instance by a given matrix.

Parameters:
m  The matrix to be used for the transformation.

void CalVector::operator *= const CalQuaternion   q
 

Transforms the vector instance by a quaternion.

This function transforms the vector instance by a given quaternion.

Parameters:
q  The quaternion to be used for the transformation.

void CalVector::operator *= const float    d
 

Scales the vector instance.

This operator scales the vector instance by multiplying its components by a specific factor.

Parameters:
d  The factor to multiply the vector components by.

void CalVector::operator+= const CalVector &    v
 

Adds another vector to the vector instance.

This operator adds another vector to the vector instance.

Parameters:
v  The vector to be added.

void CalVector::operator-= const CalVector &    v
 

Subtracts another vector from the vector instance.

This operator subtracts another vector from the vector instance.

Parameters:
v  The vector to be subtracted.

void CalVector::operator/= const float    d
 

Scales the vector instance.

This operator scales the vector instance by dividing its components by a specific factor.

Parameters:
d  The factor to divide the vector components by.

void CalVector::operator= const CalVector &    v
 

Equates the vector instance with another vector.

This operator equates the vector instance with another vector.

Parameters:
v  The vector to equate the vector instance with.

bool CalVector::operator== const CalVector &    v
 

Tests the equality of 2 vectors.

This operator checks to see if 2 vectors are equal

Parameters:
v  The vector to be tested against.

const float & CalVector::operator[] unsigned int    i const
 

Provides access to the components of the vector instance.

This function provides read access to the three components of the vector instance.

Parameters:
i  The index to the specific component.
Returns:
A constant reference to the specific component.

float & CalVector::operator[] unsigned int    i
 

Provides access to the components of the vector instance.

This function provides read and write access to the three components of the vector instance.

Parameters:
i  The index to the specific component.
Returns:
A reference to the specific component.

void CalVector::set float    vx,
float    vy,
float    vz
 

Sets new values.

This function sets new values in the vector instance.

Parameters:
x  The x component.
y  The y component.
z  The z component.


Friends And Related Function Documentation

CAL3D_API float operator * const CalVector &    v,
const CalVector &    u
[friend]
 

Calculates the dot product of two vectors.

This operator calculates the dot product of two vectors.

Parameters:
v  The first vector.
u  The second vector.
Returns:
The dot product of the two vectors.

CAL3D_API CalVector operator * const float    d,
const CalVector &    v
[friend]
 

Calculates a scaled vector.

This operator calculates the vector multiplied by a factor.

Parameters:
d  The factor to multiply the vector with.
v  The vector to be scaled.
Returns:
The scaled vector.

CAL3D_API CalVector operator * const CalVector &    v,
const float    d
[friend]
 

Calculates a scaled vector.

This operator calculates the vector multiplied by a factor.

Parameters:
v  The vector to be scaled.
d  The factor to multiply the vector with.
Returns:
The scaled vector.

CAL3D_API CalVector operator% const CalVector &    v,
const CalVector &    u
[friend]
 

Calculates the vector product of two vectors.

This operator calculates the vector product of two vectors.

Parameters:
v  The first vector.
u  The second vector.
Returns:
The vector product of the two vectors.

CAL3D_API CalVector operator+ const CalVector &    v,
const CalVector &    u
[friend]
 

Calculates the sum of two vectors.

This operator calculates the sum of two vectors.

Parameters:
v  The first vector to be added.
u  The second vector to be added.
Returns:
The sum of the two vectors.

CAL3D_API CalVector operator- const CalVector &    v,
const CalVector &    u
[friend]
 

Calculates the difference of two vectors.

This operator calculates the difference of two vectors.

Parameters:
v  The first vector to be added.
u  The second vector to be subtracted.
Returns:
The difference of the two vectors.

CAL3D_API CalVector operator/ const CalVector &    v,
const float    d
[friend]
 

Calculates a scaled vector.

This operator calculates the vector divided by a factor.

Parameters:
v  The vector to be scaled.
d  The factor to divide the vector with.
Returns:
The scaled vector.


The documentation for this class was generated from the following files:
Generated at Sun Oct 12 18:38:50 2003 by The Cal3D Team with doxygen 1.2.14 © 1997-2001 Dimitri van Heesch