CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

csDVector3 Class Reference
[Geometry utilities]

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. More...

 csDVector3 (const csDVector3 &v)
 Copy Constructor. More...

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

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

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

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

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

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

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

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

csDVector3 operator+ () const
 Unary + operator. More...

csDVector3 operator- () const
 Unary - operator. More...

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

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

double SquaredNorm () const
 Returns the norm of this vector. More...

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

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


Static Public Methods

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

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


Public Attributes

double x
 The X component of the vector. More...

double y
 The Y component of the vector. More...

double z
 The Z component of the vector. More...


Friends

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

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

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

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

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

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

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

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

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

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

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

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

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


Detailed Description

A 3D vector.

Definition at line 48 of file math3d_d.h.


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.

Definition at line 63 of file math3d_d.h.

Referenced by operator-.

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)

Definition at line 70 of file math3d_d.h.

References x, y, and z.

csDVector3::csDVector3 double    ix,
double    iy,
double    iz = 0
[inline]
 

Make a new vector and initialize with the given values.

Definition at line 73 of file math3d_d.h.

References x, y, and z.

csDVector3::csDVector3 const csDVector3 &    v [inline]
 

Copy Constructor.

Definition at line 76 of file math3d_d.h.

References x, y, and z.

csDVector3::csDVector3 const csVector3  
 

Conversion from single precision vector to double.


Member Function Documentation

void csDVector3::Cross const csDVector3 &    px,
const csDVector3 &    py
[inline]
 

Take cross product of two vectors and put result in this vector.

Definition at line 105 of file math3d_d.h.

References x, y, and z.

double csDVector3::Norm const csDVector3 &    v [inline, static]
 

Returns the norm (magnitude) of a vector.

Definition at line 207 of file math3d_d.h.

References Norm.

double csDVector3::Norm   const
 

Returns the norm of this vector.

Referenced by Norm, csDPlane::Normalize, and Unit.

void csDVector3::Normalize  
 

Scale this vector to length = 1.0.

csDVector3& csDVector3::operator *= double    f [inline]
 

Multiply this vector by a scalar.

Definition at line 177 of file math3d_d.h.

References x, y, and z.

csDVector3 csDVector3::operator+   const [inline]
 

Unary + operator.

Definition at line 185 of file math3d_d.h.

csDVector3& csDVector3::operator+= const csDVector3 &    v [inline]
 

Add another vector to this vector.

Definition at line 157 of file math3d_d.h.

References x, y, and z.

csDVector3 csDVector3::operator-   const [inline]
 

Unary - operator.

Definition at line 188 of file math3d_d.h.

References csDVector3, x, y, and z.

csDVector3& csDVector3::operator-= const csDVector3 &    v [inline]
 

Subtract another vector from this vector.

Definition at line 167 of file math3d_d.h.

References x, y, and z.

csDVector3& csDVector3::operator/= double    f [inline]
 

Divide this vector by a scalar.

Definition at line 181 of file math3d_d.h.

References x, y, and z.

double& csDVector3::operator[] int    n [inline]
 

Returns n-th component of the vector.

Definition at line 154 of file math3d_d.h.

References x, y, and z.

double csDVector3::operator[] int    n const [inline]
 

Returns n-th component of the vector.

Definition at line 151 of file math3d_d.h.

References x, y, and z.

void csDVector3::Set double    sx,
double    sy,
double    sz
[inline]
 

Set the value of this vector.

Definition at line 191 of file math3d_d.h.

References x, y, and z.

double csDVector3::SquaredNorm   const
 

Returns the norm of this vector.

csDVector3 csDVector3::Unit const csDVector3 &    v [inline, static]
 

Normalizes a vector to a unit vector.

Definition at line 210 of file math3d_d.h.

References Unit.

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.

Definition at line 204 of file math3d_d.h.

References Norm.

Referenced by Unit.


Friends And Related Function Documentation

csDVector3 operator * double    f,
const csDVector3 &    v
[friend]
 

Multiply a vector and a scalar.

Definition at line 117 of file math3d_d.h.

csDVector3 operator * const csDVector3 &    v,
double    f
[friend]
 

Multiply a vector and a scalar.

Definition at line 113 of file math3d_d.h.

double operator * const csDVector3 &    v1,
const csDVector3 &    v2
[friend]
 

Take the dot product of two vectors.

Definition at line 92 of file math3d_d.h.

bool operator!= const csDVector3 &    v1,
const csDVector3 &    v2
[friend]
 

Check if two vectors are not equal.

Definition at line 129 of file math3d_d.h.

csDVector3 operator% const csDVector3 &    v1,
const csDVector3 &    v2
[friend]
 

Take the cross product of two vectors.

Definition at line 97 of file math3d_d.h.

csDVector3 operator+ const csDVector3 &    v1,
const csDVector3 &    v2
[friend]
 

Add two vectors.

Definition at line 83 of file math3d_d.h.

csDVector3 operator- const csDVector3 &    v1,
const csDVector3 &    v2
[friend]
 

Subtract two vectors.

Definition at line 88 of file math3d_d.h.

csDVector3 operator/ const csDVector3 &    v,
double    f
[friend]
 

Divide a vector by a scalar.

Definition at line 121 of file math3d_d.h.

bool operator< const csDVector3 &    v,
double    f
[friend]
 

Test if each component of a vector is less than a small epsilon value.

Definition at line 143 of file math3d_d.h.

csDVector3 operator<< const csDVector3 &    v1,
const csDVector3 &    v2
[friend]
 

Project one vector onto another.

Definition at line 139 of file math3d_d.h.

bool operator== const csDVector3 &    v1,
const csDVector3 &    v2
[friend]
 

Check if two vectors are equal.

Definition at line 125 of file math3d_d.h.

bool operator> double    f,
const csDVector3 &    v
[friend]
 

Test if each component of a vector is greater than a small epsilon value.

Definition at line 147 of file math3d_d.h.

csDVector3 operator>> const csDVector3 &    v1,
const csDVector3 &    v2
[friend]
 

Project one vector onto another.

Definition at line 134 of file math3d_d.h.


Member Data Documentation

double csDVector3::x
 

The X component of the vector.

Definition at line 52 of file math3d_d.h.

Referenced by csDPlane::A, csDMath3::Area3, csDPlane::Classify, Cross, csDVector3, csDVector4::csDVector4, operator *=, operator+=, operator-, operator-=, operator/=, operator[], csDSquaredDist::PointPoint, csDPlane::Set, Set, csDMath3::SetMinMax, and csDMath3::WhichSide3D.

double csDVector3::y
 

The Y component of the vector.

Definition at line 54 of file math3d_d.h.

Referenced by csDMath3::Area3, csDPlane::B, csDPlane::Classify, Cross, csDVector3, csDVector4::csDVector4, operator *=, operator+=, operator-, operator-=, operator/=, operator[], csDSquaredDist::PointPoint, csDPlane::Set, Set, csDMath3::SetMinMax, and csDMath3::WhichSide3D.

double csDVector3::z
 

The Z component of the vector.

Definition at line 56 of file math3d_d.h.

Referenced by csDMath3::Area3, csDPlane::C, csDPlane::Classify, Cross, csDVector3, csDVector4::csDVector4, operator *=, operator+=, operator-, operator-=, operator/=, operator[], csDSquaredDist::PointPoint, csDPlane::Set, Set, csDMath3::SetMinMax, and csDMath3::WhichSide3D.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.14