ADTF Display Toolbox
Loading...
Searching...
No Matches
cVector3

3D vector class. More...

#include <vector3.h>

Inheritance diagram for cVector3:
[legend]

Public Member Functions

 cVector3 ()
 Constructor.
 
 cVector3 (const IVector3 *pVector3)
 constructor from IVector3
 
 cVector3 (const tFloat64 f64X, const tFloat64 f64Y, const tFloat64 f64Z)
 Constructor.
 
tVoid Release ()
 Releases this vector.
 
OPT_INLINE void Set (const cVector3 &Vector)
 Set vector to the given value.
 
OPT_INLINE void Set (const tFloat64 Value)
 Set vector to the given value.
 
OPT_INLINE void Set (const tFloat64 f64X, const tFloat64 f64Y, const tFloat64 f64Z)
 Set vector to the given value.
 
OPT_INLINE void Zero ()
 Set vector to zero.
 
OPT_INLINE void Add (const cVector3 &Vector)
 Add the given vector to the current one.
 
OPT_INLINE void Sub (const cVector3 &Vector)
 Subtract the given vector from the current one.
 
OPT_INLINE void Scale (const tFloat64 Value)
 Scale the current vector by the given value.
 
OPT_INLINE void Scale (const cVector3 &Vector)
 Scale the current vector by the given one.
 
OPT_INLINE cVector3 Scalar (const cVector3 &Vector) const
 Multiply every coordinate of the current vector with the corresponding coordinate from the given one.
 
OPT_INLINE cVector3 Multiply (const cVector3 &Vector) const
 Cross product of the current vector and the given one.
 
tFloat Length () const
 Calculate the length of the current vector.
 
void Normalize ()
 Normalize the current vector so that the length becomes one.
 
void Dump ()
 Dump the current vector to stdout.
 
tFloat64 GetX () const
 gets the value of the x component
 
tVoid SetX (tFloat64 f64XValue)
 Set the current x value to the given one.
 
tFloat64 GetY () const
 gets the value of the y component
 
tVoid SetY (tFloat64 f64YValue)
 Set the current y value to the given one.
 
tFloat64 GetZ () const
 gets the value of the z component
 
tVoid SetZ (tFloat64 f64ZValue)
 Set the current z value to the given one.
 
cVector3 operator= (const cVector3 &v)
 Set the current vector to the given one.
 
cVector3 operator- (void)
 Negate the current vector.
 
 operator IVector3 * ()
 instance of IVector3
 
- Public Member Functions inherited from IVector3
virtual ~IVector3 ()
 virtual destructor to ensure proper cleanup.
 

Static Public Attributes

static const cVector3 Null
 Null vector.
 
static const cVector3 One
 Identity vector.
 

Private Attributes

tFloat64 x
 X coordinate of vector.
 
tFloat64 y
 Y coordinate of vector.
 
tFloat64 z
 Z coordinate of vector.
 

Static Private Attributes

static const tFloat64 nullScalar
 scalar null value
 
static const tFloat64 oneScalar
 scalar identity value
 

Detailed Description

3D vector class.

Definition at line 31 of file vector3.h.

Constructor & Destructor Documentation

◆ cVector3() [1/3]

cVector3 ( )
inline

Constructor.

Definition at line 49 of file vector3.h.

◆ cVector3() [2/3]

cVector3 ( const IVector3 * pVector3)
inline

constructor from IVector3

Parameters
[in]pVector3Vector3

Definition at line 59 of file vector3.h.

◆ cVector3() [3/3]

cVector3 ( const tFloat64 f64X,
const tFloat64 f64Y,
const tFloat64 f64Z )
inline

Constructor.

Parameters
f64X[in] X coordinate of vector.
f64Y[in] Y coordinate of vector.
f64Z[in] Z coordinate of vector.

Definition at line 71 of file vector3.h.

Member Function Documentation

◆ Add()

OPT_INLINE void Add ( const cVector3 & Vector)
inline

Add the given vector to the current one.

Parameters
Vector[in] Vector to add.

Definition at line 133 of file vector3.h.

◆ Dump()

void Dump ( )
inline

Dump the current vector to stdout.

Definition at line 235 of file vector3.h.

◆ GetX()

tFloat64 GetX ( ) const
inlinevirtual

gets the value of the x component

Returns
value of x component

Implements IVector3.

Definition at line 251 of file vector3.h.

◆ GetY()

tFloat64 GetY ( ) const
inlinevirtual

gets the value of the y component

Returns
value of y component

Implements IVector3.

Definition at line 272 of file vector3.h.

◆ GetZ()

tFloat64 GetZ ( ) const
inlinevirtual

gets the value of the z component

Returns
value of z component

Implements IVector3.

Definition at line 293 of file vector3.h.

◆ Length()

tFloat Length ( ) const
inlinevirtual

Calculate the length of the current vector.

Returns
Length of the current vector.

Implements IVector3.

Definition at line 210 of file vector3.h.

◆ Multiply()

OPT_INLINE cVector3 Multiply ( const cVector3 & Vector) const
inline

Cross product of the current vector and the given one.

Parameters
Vector[in] Vector for multiplication.
Returns
New vector.

Definition at line 198 of file vector3.h.

◆ Normalize()

void Normalize ( )
inline

Normalize the current vector so that the length becomes one.

Definition at line 218 of file vector3.h.

◆ operator IVector3 *()

operator IVector3 * ( )
inlineexplicit

instance of IVector3

Returns
object

Definition at line 474 of file vector3.h.

◆ operator-()

cVector3 operator- ( void )
inline

Negate the current vector.

Returns
New vector.

Definition at line 328 of file vector3.h.

◆ operator=()

cVector3 operator= ( const cVector3 & v)
inline

Set the current vector to the given one.

Parameters
v[in] Vector.
Returns
New vector.

Definition at line 316 of file vector3.h.

◆ Release()

tVoid Release ( )
inlinevirtual

Releases this vector.

Implements IVector3.

Definition at line 79 of file vector3.h.

◆ Scalar()

OPT_INLINE cVector3 Scalar ( const cVector3 & Vector) const
inline

Multiply every coordinate of the current vector with the corresponding coordinate from the given one.

Parameters
Vector[in] Vector for multiplication.
Returns
New vector.

Definition at line 186 of file vector3.h.

◆ Scale() [1/2]

OPT_INLINE void Scale ( const cVector3 & Vector)
inline

Scale the current vector by the given one.

Parameters
Vector[in] Vector with scaling factors.

Definition at line 169 of file vector3.h.

◆ Scale() [2/2]

OPT_INLINE void Scale ( const tFloat64 Value)
inline

Scale the current vector by the given value.

Parameters
Value[in] Scaling factor.

Definition at line 157 of file vector3.h.

◆ Set() [1/3]

OPT_INLINE void Set ( const cVector3 & Vector)
inline

Set vector to the given value.

Parameters
Vector[in] Value for vector.

Definition at line 89 of file vector3.h.

◆ Set() [2/3]

OPT_INLINE void Set ( const tFloat64 f64X,
const tFloat64 f64Y,
const tFloat64 f64Z )
inline

Set vector to the given value.

Parameters
f64X[in] X value for vector.
f64Y[in] Y value for vector.
f64Z[in] Z value for vector.

Definition at line 113 of file vector3.h.

◆ Set() [3/3]

OPT_INLINE void Set ( const tFloat64 Value)
inline

Set vector to the given value.

Parameters
Value[in] Value for vector.

Definition at line 101 of file vector3.h.

◆ SetX()

tVoid SetX ( tFloat64 f64XValue)
inlinevirtual

Set the current x value to the given one.

Parameters
xValue[in] x value to set
Returns
void

Implements IVector3.

Definition at line 262 of file vector3.h.

◆ SetY()

tVoid SetY ( tFloat64 f64YValue)
inlinevirtual

Set the current y value to the given one.

Parameters
f64YValue[in] y value to set
Returns
void

Implements IVector3.

Definition at line 283 of file vector3.h.

◆ SetZ()

tVoid SetZ ( tFloat64 f64ZValue)
inlinevirtual

Set the current z value to the given one.

Parameters
zValue[in] z value to set
Returns
void

Implements IVector3.

Definition at line 304 of file vector3.h.

◆ Sub()

OPT_INLINE void Sub ( const cVector3 & Vector)
inline

Subtract the given vector from the current one.

Parameters
Vector[in] Vector to subtract.

Definition at line 145 of file vector3.h.

◆ Zero()

OPT_INLINE void Zero ( )
inline

Set vector to zero.

Definition at line 123 of file vector3.h.

Member Data Documentation

◆ Null

const cVector3 Null
inlinestatic

Null vector.

Definition at line 42 of file vector3.h.

◆ nullScalar

const tFloat64 nullScalar
inlinestaticprivate

scalar null value

Definition at line 38 of file vector3.h.

◆ One

const cVector3 One
inlinestatic

Identity vector.

Definition at line 43 of file vector3.h.

◆ oneScalar

const tFloat64 oneScalar
inlinestaticprivate

scalar identity value

Definition at line 39 of file vector3.h.

◆ x

tFloat64 x
private

X coordinate of vector.

Definition at line 34 of file vector3.h.

◆ y

tFloat64 y
private

Y coordinate of vector.

Definition at line 35 of file vector3.h.

◆ z

tFloat64 z
private

Z coordinate of vector.

Definition at line 36 of file vector3.h.