Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csDVector3 Class Reference

A 3D vector. More...

#include <math3d_d.h>

List of all members.

Public Methods

 csDVector3 ()
 Make a new vector. More...

 csDVector3 (double m)
 Make a new initialized vector. More...

 csDVector3 (double ix, double iy, double iz=0)
 Make a new vector and initialize with the given values.

 csDVector3 (const csDVector3 &v)
 Copy Constructor.

 csDVector3 (const csVector3 &)
 Conversion from single precision vector to double.

void Cross (const csDVector3 &px, const csDVector3 &py)
 Take cross product of two vectors and put result in this vector.

double operator[] (int n) const
 Returns n-th component of the vector.

double& operator[] (int n)
 Returns n-th component of the vector.

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

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

csDVector3& operator *= (double f)
 Multiply this vector by a scalar.

csDVector3& operator/= (double f)
 Divide this vector by a scalar.

csDVector3 operator+ () const
 Unary + operator.

csDVector3 operator- () const
 Unary - operator.

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

double Norm () const
 Returns the norm of this vector.

csDVector3 Unit () const
 Returns the unit vector in the direction of this vector. More...

void Normalize ()
 Scale this vector to length = 1.0.


Public Attributes

double x
 The X component of the vector.

double y
 The Y component of the vector.

double z
 The Z component of the vector.


Static Public Methods

double Norm (const csDVector3 &v)
 Returns the norm (magnitude) of a vector.

csDVector3 Unit (const csDVector3 &v)
 Normalizes a vector to a unit vector.


Friends

csDVector3 operator+ (const csDVector3 &v1, const csDVector3 &v2)
 Add two vectors.

csDVector3 operator- (const csDVector3 &v1, const csDVector3 &v2)
 Subtract two vectors.

double operator * (const csDVector3 &v1, const csDVector3 &v2)
 Take the dot product of two vectors.

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

csDVector3 operator * (const csDVector3 &v, double f)
 Multiply a vector and a scalar.

csDVector3 operator * (double f, const csDVector3 &v)
 Multiply a vector and a scalar.

csDVector3 operator/ (const csDVector3 &v, double f)
 Divide a vector by a scalar.

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

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

csDVector3 operator>> (const csDVector3 &v1, const csDVector3 &v2)
 Project one vector onto another.

csDVector3 operator<< (const csDVector3 &v1, const csDVector3 &v2)
 Project one vector onto another.

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

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


Detailed Description

A 3D vector.


Constructor & Destructor Documentation

csDVector3::csDVector3 ( ) [inline]
 

Make a new vector.

The vector is not initialized. This makes the code slightly faster as csDVector3 objects are used a lot.

csDVector3::csDVector3 ( double m ) [inline]
 

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 csDVector3(0)


Member Function Documentation

csDVector3 csDVector3::Unit ( ) const [inline]
 

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.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000