TrueReality  v0.1.1912
trBase::Vec3d Class Reference

General purpose 3D double Vector. More...

#include <Vec3d.h>

Public Types

using value_type = double
 Data type of vector components. More...
 

Public Member Functions

 Vec3d ()
 Default constructor. More...
 
 Vec3d (value_type x, value_type y, value_type z)
 Constructor. More...
 
 Vec3d (const osg::Vec3d &v)
 Copy Constructor from osg::Vec to trBase::Vec. More...
 
 Vec3d (const osg::Vec3f &v)
 Copy Constructor from osg::Vec to trBase::Vec. More...
 
const osg::Vec3d & GetOSGVector () const
 Returns the internal OSG vector. More...
 
value_type Length () const
 Length of the vector = sqrt( vec . More...
 
value_type Length2 () const
 Length squared of the vector = vec . More...
 
value_type Normalize ()
 Normalize the vector so that it has length unity. More...
 
value_typeX ()
 Returns the X component of the vector. More...
 
value_typeY ()
 Returns the Y component of the vector. More...
 
value_typeZ ()
 Returns the Z component of the vector. More...
 
value_type X () const
 Returns the X component of the vector. More...
 
value_type Y () const
 Returns the Y component of the vector. More...
 
value_type Z () const
 Returns the Z component of the vector. More...
 
value_typeR ()
 Returns the R component of the vector. More...
 
value_typeG ()
 Returns the G component of the vector. More...
 
value_typeB ()
 Returns the B component of the vector. More...
 
value_type R () const
 Returns the R component of the vector. More...
 
value_type G () const
 Returns the G component of the vector. More...
 
value_type B () const
 Returns the B component of the vector. More...
 
void Set (value_type x, value_type y, value_type z)
 Sets the initial values of the vector. More...
 
void Set (const Vec3d &v)
 Sets the initial values of the vector. More...
 
void SetRGB (value_type r, value_type g, value_type b)
 Sets the initial values of the vector. More...
 
void Lerp (const Vec3d &to, value_type alpha)
 Linear interpolation of this vector to a passed in vector. More...
 
Vec3d Lerp (const Vec3d &from, const Vec3d &to, value_type alpha)
 Linear interpolation of two vectors. More...
 
std::string ToString (int precision=-1)
 Convert this object into a string representation. More...
 
value_typePtr ()
 Pointer to the internal Vector array. More...
 
const value_typePtr () const
 Pointer to the internal Vector array. More...
 
value_typeoperator[] (int i)
 Index operator. More...
 
value_type operator[] (int i) const
 Index operator. More...
 
void operator= (const Vec3d &v)
 Set operator. More...
 
void operator= (const Vec3f &v)
 Set operator. More...
 
void operator= (const osg::Vec3d &v)
 Set operator. More...
 
bool operator== (const Vec3d &v) const
 Equality operator. More...
 
bool operator!= (const Vec3d &v) const
 Inequality operator. More...
 
bool operator< (const Vec3d &v) const
 Less than operator. More...
 
bool operator> (const Vec3d &v) const
 Greater than operator. More...
 
value_type operator* (const Vec3d &rhs) const
 Dot product operator. More...
 
const Vec3d operator* (value_type rhs) const
 Scalar multiplication operator. More...
 
Vec3doperator*= (value_type rhs)
 Unary scalar multiplication operator. More...
 
const Vec3d operator/ (value_type rhs) const
 Divide by scalar operator. More...
 
Vec3doperator/= (value_type rhs)
 Unary divide by scalar operator. More...
 
const Vec3d operator+ (const Vec3d &rhs) const
 Binary vector add operator. More...
 
Vec3doperator+= (const Vec3d &rhs)
 Unary vector add operator. More...
 
const Vec3d operator- (const Vec3d &rhs) const
 Binary vector subtraction operator. More...
 
Vec3doperator-= (const Vec3d &rhs)
 Unary vector subtraction operator. More...
 
const Vec3d operator- () const
 Negation operator. More...
 
const Vec3d operator^ (const Vec3d &rhs) const
 Cross product operator. More...
 
 operator osg::Vec3d () const
 Implicit conversion operator to OSG Vector. More...
 
 operator osg::Vec3d & ()
 Implicit conversion operator to OSG Vector. More...
 
 operator const osg::Vec3d & () const
 Implicit conversion operator to OSG Vector. More...
 
 operator osg::Vec3d * ()
 Implicit conversion operator to OSG Vector. More...
 

Static Public Attributes

static const int NUM_OF_COMPONENTS
 

Protected Attributes

osg::Vec3d mVec
 

Detailed Description

General purpose 3D double Vector.

Definition at line 47 of file Vec3d.h.

Member Typedef Documentation

◆ value_type

using trBase::Vec3d::value_type = double

Data type of vector components.

Definition at line 52 of file Vec3d.h.

Constructor & Destructor Documentation

◆ Vec3d() [1/4]

trBase::Vec3d::Vec3d ( )

Default constructor.

◆ Vec3d() [2/4]

trBase::Vec3d::Vec3d ( value_type  x,
value_type  y,
value_type  z 
)

Constructor.

Parameters
xThe x component of the vector.
yThe y component of the vector.
zThe z component of the vector.

◆ Vec3d() [3/4]

trBase::Vec3d::Vec3d ( const osg::Vec3d &  v)

Copy Constructor from osg::Vec to trBase::Vec.

Parameters
vThe osg::Vec3d to process.

◆ Vec3d() [4/4]

trBase::Vec3d::Vec3d ( const osg::Vec3f &  v)

Copy Constructor from osg::Vec to trBase::Vec.

Parameters
vThe osg::Vec3f to process.

Definition at line 33 of file Vec3d.cpp.

Member Function Documentation

◆ B() [1/2]

value_type& trBase::Vec3d::B ( )

Returns the B component of the vector.

◆ B() [2/2]

value_type trBase::Vec3d::B ( ) const

Returns the B component of the vector.

◆ G() [1/2]

value_type& trBase::Vec3d::G ( )

Returns the G component of the vector.

◆ G() [2/2]

value_type trBase::Vec3d::G ( ) const

Returns the G component of the vector.

◆ GetOSGVector()

const osg::Vec3d& trBase::Vec3d::GetOSGVector ( ) const

Returns the internal OSG vector.

◆ Length()

value_type trBase::Vec3d::Length ( ) const

Length of the vector = sqrt( vec .

vec )

◆ Length2()

value_type trBase::Vec3d::Length2 ( ) const

Length squared of the vector = vec .

vec

◆ Lerp() [1/2]

void trBase::Vec3d::Lerp ( const Vec3d to,
value_type  alpha 
)

Linear interpolation of this vector to a passed in vector.

Parameters
toThe vector that we are interpolating to.
alphaAmount of change (0-1).

◆ Lerp() [2/2]

Vec3d trBase::Vec3d::Lerp ( const Vec3d from,
const Vec3d to,
value_type  alpha 
)

Linear interpolation of two vectors.

Parameters
fromThe vector that we are interpolating from.
toThe vector that we are interpolating to.
alphaAmount of change (0-1).
Returns
An interpolated vector.

◆ Normalize()

value_type trBase::Vec3d::Normalize ( )

Normalize the vector so that it has length unity.

Returns the previous length of the vector.

◆ operator const osg::Vec3d &()

trBase::Vec3d::operator const osg::Vec3d & ( ) const

Implicit conversion operator to OSG Vector.

◆ operator osg::Vec3d()

trBase::Vec3d::operator osg::Vec3d ( ) const

Implicit conversion operator to OSG Vector.

◆ operator osg::Vec3d &()

trBase::Vec3d::operator osg::Vec3d & ( )

Implicit conversion operator to OSG Vector.

◆ operator osg::Vec3d *()

trBase::Vec3d::operator osg::Vec3d * ( )

Implicit conversion operator to OSG Vector.

◆ operator!=()

bool trBase::Vec3d::operator!= ( const Vec3d v) const

Inequality operator.

◆ operator*() [1/2]

value_type trBase::Vec3d::operator* ( const Vec3d rhs) const

Dot product operator.

◆ operator*() [2/2]

const Vec3d trBase::Vec3d::operator* ( value_type  rhs) const

Scalar multiplication operator.

◆ operator*=()

Vec3d& trBase::Vec3d::operator*= ( value_type  rhs)

Unary scalar multiplication operator.

◆ operator+()

const Vec3d trBase::Vec3d::operator+ ( const Vec3d rhs) const

Binary vector add operator.

◆ operator+=()

Vec3d& trBase::Vec3d::operator+= ( const Vec3d rhs)

Unary vector add operator.

Slightly more efficient because it has no temporary intermediate objects.

◆ operator-() [1/2]

const Vec3d trBase::Vec3d::operator- ( const Vec3d rhs) const

Binary vector subtraction operator.

◆ operator-() [2/2]

const Vec3d trBase::Vec3d::operator- ( ) const

Negation operator.

Returns the negative of the Vec3d.

◆ operator-=()

Vec3d& trBase::Vec3d::operator-= ( const Vec3d rhs)

Unary vector subtraction operator.

◆ operator/()

const Vec3d trBase::Vec3d::operator/ ( value_type  rhs) const

Divide by scalar operator.

◆ operator/=()

Vec3d& trBase::Vec3d::operator/= ( value_type  rhs)

Unary divide by scalar operator.

◆ operator<()

bool trBase::Vec3d::operator< ( const Vec3d v) const

Less than operator.

◆ operator=() [1/3]

void trBase::Vec3d::operator= ( const Vec3d v)

Set operator.

◆ operator=() [2/3]

void trBase::Vec3d::operator= ( const Vec3f v)

Set operator.

Definition at line 39 of file Vec3d.cpp.

References mVec, trBase::Vec3f::X(), trBase::Vec3f::Y(), and trBase::Vec3f::Z().

Here is the call graph for this function:

◆ operator=() [3/3]

void trBase::Vec3d::operator= ( const osg::Vec3d &  v)

Set operator.

◆ operator==()

bool trBase::Vec3d::operator== ( const Vec3d v) const

Equality operator.

◆ operator>()

bool trBase::Vec3d::operator> ( const Vec3d v) const

Greater than operator.

◆ operator[]() [1/2]

value_type& trBase::Vec3d::operator[] ( int  i)

Index operator.

◆ operator[]() [2/2]

value_type trBase::Vec3d::operator[] ( int  i) const

Index operator.

◆ operator^()

const Vec3d trBase::Vec3d::operator^ ( const Vec3d rhs) const

Cross product operator.

◆ Ptr() [1/2]

value_type* trBase::Vec3d::Ptr ( )

Pointer to the internal Vector array.

◆ Ptr() [2/2]

const value_type* trBase::Vec3d::Ptr ( ) const

Pointer to the internal Vector array.

◆ R() [1/2]

value_type& trBase::Vec3d::R ( )

Returns the R component of the vector.

◆ R() [2/2]

value_type trBase::Vec3d::R ( ) const

Returns the R component of the vector.

◆ Set() [1/2]

void trBase::Vec3d::Set ( value_type  x,
value_type  y,
value_type  z 
)

Sets the initial values of the vector.

◆ Set() [2/2]

void trBase::Vec3d::Set ( const Vec3d v)

Sets the initial values of the vector.

◆ SetRGB()

void trBase::Vec3d::SetRGB ( value_type  r,
value_type  g,
value_type  b 
)

Sets the initial values of the vector.

◆ ToString()

std::string trBase::Vec3d::ToString ( int  precision = -1)

Convert this object into a string representation.

Parameters
precision(Optional) The precision.
Returns
A std::string that represents this object.

◆ X() [1/2]

value_type& trBase::Vec3d::X ( )

Returns the X component of the vector.

Referenced by trBase::Vec3f::operator=().

Here is the caller graph for this function:

◆ X() [2/2]

value_type trBase::Vec3d::X ( ) const

Returns the X component of the vector.

◆ Y() [1/2]

value_type& trBase::Vec3d::Y ( )

Returns the Y component of the vector.

Referenced by trBase::Vec3f::operator=().

Here is the caller graph for this function:

◆ Y() [2/2]

value_type trBase::Vec3d::Y ( ) const

Returns the Y component of the vector.

◆ Z() [1/2]

value_type& trBase::Vec3d::Z ( )

Returns the Z component of the vector.

Referenced by trBase::Vec3f::operator=().

Here is the caller graph for this function:

◆ Z() [2/2]

value_type trBase::Vec3d::Z ( ) const

Returns the Z component of the vector.

Member Data Documentation

◆ mVec

osg::Vec3d trBase::Vec3d::mVec
protected

Definition at line 343 of file Vec3d.h.

Referenced by operator=().

◆ NUM_OF_COMPONENTS

const int trBase::Vec3d::NUM_OF_COMPONENTS
static

Definition at line 54 of file Vec3d.h.


The documentation for this class was generated from the following files: