CVector3D Class Reference

Mange a 3D vector. More...

#include <vectorMath.h>

List of all members.

Public Member Functions

Create methods
 CVector3D ()
 Create a zero vector.
 CVector3D (const unit inX, const unit inY, const unit inZ)
 Create using 3 unit values.
 CVector3D (const CVector3D &inVec)
 Create using another vector.
 CVector3D (const VECTOR *inVec)
 Create using an Acknex vector.
Set/Reset methods
void set (const unit inX, const unit inY, const unit inZ)
 Set using 3 unit values.
void reset ()
 Reset all values to zero.
void x (const unit f)
 Set x.
void y (const unit f)
 Set y.
void z (const unit f)
 Set z.
unit x () const
 Get x.
unit y () const
 Get y.
unit z () const
 Get z.
Add methods
void add (const unit inX, const unit inY, const unit inZ)
 Add to the current values.
void addX (const unit f)
 Add to the current X value.
void addY (const unit f)
 Add to the current Y value.
void addZ (const unit f)
 Add to the current Z value.
Compare methods
bool is_close_to (const CVector3D &b) const
 
Returns:
true if all three values in this vector are close to all three values in the second vector.

bool is_close_to_zero () const
 
Returns:
true if all three values in is vector are close to zero.

Move/Rotate methods
CVector3D move (const CAngle3D &ang, const unit f)
 Create a new vector by moving f units along an angle from the current vector.
CVector3D move (const CAngle3D &ang, const CVector3D &moveVec)
 Create a new vector by adding the rotated moveVec to the current vector.
void rotate (const CAngle3D &ang)
 Rotate x,y,z values around origin by angle ang.
Operator Overloads
CVector3D operator+ (const CVector3D &inVec) const
 Add two vectors.
CVector3D operator- (const CVector3D &inVec) const
 Subtract vectors.
CVector3D operator * (const unit f) const
 Scale vector.
void operator *= (const unit f)
 Scale vector.
CVector3D operator/ (const unit f) const
 Reduce vector.
void operator+= (const CVector3D &inVec)
 Add another vector.
void operator-= (const CVector3D &inVec)
 Subtract another vector.
CVector3D operator * (const CVector3D &inVec) const
 Scale the values of the first vector by the values of the second.
void operator *= (const CVector3D &inVec)
 Scale the values of this vector by the values of the other vector.
Misc methods
unit get_pan () const
 
Returns:
The pan of this vector.

unit get_tilt () const
 
Returns:
The tilt of this vector.

void get_array (unit array[]) const
 Get vector values as an array.
unit get_length () const
unit get_length_sq () const
CVector3D get_normalized (const unit f=1.0) const
 Change the length of the vector (keeping the direction).


Detailed Description

Mange a 3D vector.

(c) 2007-2008 oP group Germany GbR. All rights reserved.
This source code is provided "as is" with no warranty and must not be distributed without written permission.

Author:
Doug Poston
Version:
1.3
Date:
12/28/2007

Member Function Documentation

CVector3D CVector3D::move ( const CAngle3D ang,
const unit  f 
)

Create a new vector by moving f units along an angle from the current vector.

Parameters:
ang Angle we are moving along.
f Distance moved.
Returns:
New vector.
Add a rotated unit vector of length f <f,0,0>
Parameters:
ang Angle of rotation
f Lenth of movement vector
Returns:
Rotated movement vector

CVector3D CVector3D::move ( const CAngle3D ang,
const CVector3D moveVec 
)

Create a new vector by adding the rotated moveVec to the current vector.

Parameters:
ang Angle we are moving along.
moveVec Vector to be rotated.
Returns:
New vector.
Add a rotated vector
Parameters:
ang Angle of rotation
moveVec Movement vector
Returns:
Rotated movement vector

void CVector3D::rotate ( const CAngle3D ang  ) 

Rotate x,y,z values around origin by angle ang.

Parameters:
ang Angle used for rotation.
Rotate around origin by CAngle3D ang
Parameters:
ang Angle of rotation
Note:
angle values are in degrees
Parameters:
ang  rotate x,y,z values around origin by angle ang

void CVector3D::get_array ( unit  array[]  )  const [inline]

Get vector values as an array.

Parameters:
array A unit array of at least 3 values.
Note:
Will crash is array is not at least 3 units in size.

unit CVector3D::get_length (  )  const [inline]

Returns:
The length of this vector.
See also:
get_length_sq()

unit CVector3D::get_length_sq (  )  const [inline]

Returns:
The length squared of this vector.
Note:
Much quicker than normal get_length().
See also:
get_length()

CVector3D CVector3D::get_normalized ( const unit  f = 1.0  )  const [inline]

Change the length of the vector (keeping the direction).

Parameters:
f New length.
Returns:
A normalized vector.


The documentation for this class was generated from the following files:
Generated on Fri Dec 28 12:55:07 2007 for template7 by  doxygen 1.5.4