TrueReality  v0.1.1912
trBase::Vec2ub Class Reference

General purpose 2D unsigned byte Vector. More...

#include <Vec2ub.h>

Public Types

using value_type = unsigned char
 Data type of vector components. More...
 

Public Member Functions

 Vec2ub ()
 Default constructor. More...
 
 Vec2ub (value_type x, value_type y)
 Constructor. More...
 
 Vec2ub (const osg::Vec2ub &v)
 Copy Constructor from osg::Vec to trBase::Vec. More...
 
const osg::Vec2ub & 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_type X () const
 Returns the X component of the vector. More...
 
value_type Y () const
 Returns the Y component of the vector. More...
 
void Set (value_type x, value_type y)
 Sets the initial values of the vector. More...
 
void Lerp (const Vec2ub &to, value_type alpha)
 Linear interpolation of this vector to a passed in vector. More...
 
Vec2ub Lerp (const Vec2ub &from, const Vec2ub &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 Vec2ub &v)
 Set operator. More...
 
void operator= (const osg::Vec2ub &v)
 Set operator. More...
 
bool operator== (const Vec2ub &v) const
 Equality operator. More...
 
bool operator!= (const Vec2ub &v) const
 Inequality operator. More...
 
bool operator< (const Vec2ub &v) const
 Less than operator. More...
 
bool operator> (const Vec2ub &v) const
 Greater than operator. More...
 
value_type operator* (const Vec2ub &rhs) const
 Dot product operator. More...
 
const Vec2ub operator* (value_type rhs) const
 Scalar multiplication operator. More...
 
Vec2uboperator*= (value_type rhs)
 Unary scalar multiplication operator. More...
 
const Vec2ub operator/ (value_type rhs) const
 Divide by scalar operator. More...
 
Vec2uboperator/= (value_type rhs)
 Unary divide by scalar operator. More...
 
const Vec2ub operator+ (const Vec2ub &rhs) const
 Binary vector add operator. More...
 
Vec2uboperator+= (const Vec2ub &rhs)
 Unary vector add operator. More...
 
const Vec2ub operator- (const Vec2ub &rhs) const
 Binary vector subtraction operator. More...
 
Vec2uboperator-= (const Vec2ub &rhs)
 Unary vector subtraction operator. More...
 
const Vec2ub operator- () const
 Negation operator. More...
 
 operator osg::Vec2ub () const
 Implicit conversion operator to OSG Vector. More...
 
 operator osg::Vec2ub & ()
 Implicit conversion operator to OSG Vector. More...
 
 operator const osg::Vec2ub & () const
 Implicit conversion operator to OSG Vector. More...
 
 operator osg::Vec2ub * ()
 Implicit conversion operator to OSG Vector. More...
 

Static Public Attributes

static const int NUM_OF_COMPONENTS
 

Protected Attributes

osg::Vec2ub mVec
 

Detailed Description

General purpose 2D unsigned byte Vector.

Definition at line 39 of file Vec2ub.h.

Member Typedef Documentation

◆ value_type

using trBase::Vec2ub::value_type = unsigned char

Data type of vector components.

Definition at line 44 of file Vec2ub.h.

Constructor & Destructor Documentation

◆ Vec2ub() [1/3]

trBase::Vec2ub::Vec2ub ( )

Default constructor.

◆ Vec2ub() [2/3]

trBase::Vec2ub::Vec2ub ( value_type  x,
value_type  y 
)

Constructor.

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

◆ Vec2ub() [3/3]

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

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

Parameters
vThe osg::Vec2 to process.

Member Function Documentation

◆ GetOSGVector()

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

Returns the internal OSG vector.

◆ Length()

value_type trBase::Vec2ub::Length ( ) const

Length of the vector = sqrt( vec .

vec )

◆ Length2()

value_type trBase::Vec2ub::Length2 ( ) const

Length squared of the vector = vec .

vec

◆ Lerp() [1/2]

void trBase::Vec2ub::Lerp ( const Vec2ub 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]

Vec2ub trBase::Vec2ub::Lerp ( const Vec2ub from,
const Vec2ub 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::Vec2ub::Normalize ( )

Normalize the vector so that it has length unity.

Returns the previous length of the vector.

◆ operator const osg::Vec2ub &()

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

Implicit conversion operator to OSG Vector.

◆ operator osg::Vec2ub()

trBase::Vec2ub::operator osg::Vec2ub ( ) const

Implicit conversion operator to OSG Vector.

◆ operator osg::Vec2ub &()

trBase::Vec2ub::operator osg::Vec2ub & ( )

Implicit conversion operator to OSG Vector.

◆ operator osg::Vec2ub *()

trBase::Vec2ub::operator osg::Vec2ub * ( )

Implicit conversion operator to OSG Vector.

◆ operator!=()

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

Inequality operator.

◆ operator*() [1/2]

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

Dot product operator.

◆ operator*() [2/2]

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

Scalar multiplication operator.

◆ operator*=()

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

Unary scalar multiplication operator.

◆ operator+()

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

Binary vector add operator.

◆ operator+=()

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

Unary vector add operator.

Slightly more efficient because it has no temporary intermediate objects.

◆ operator-() [1/2]

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

Binary vector subtraction operator.

◆ operator-() [2/2]

const Vec2ub trBase::Vec2ub::operator- ( ) const

Negation operator.

Returns the negative of the Vec2d.

◆ operator-=()

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

Unary vector subtraction operator.

◆ operator/()

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

Divide by scalar operator.

◆ operator/=()

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

Unary divide by scalar operator.

◆ operator<()

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

Less than operator.

◆ operator=() [1/2]

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

Set operator.

◆ operator=() [2/2]

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

Set operator.

◆ operator==()

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

Equality operator.

◆ operator>()

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

Greater than operator.

◆ operator[]() [1/2]

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

Index operator.

◆ operator[]() [2/2]

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

Index operator.

◆ Ptr() [1/2]

value_type* trBase::Vec2ub::Ptr ( )

Pointer to the internal Vector array.

◆ Ptr() [2/2]

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

Pointer to the internal Vector array.

◆ Set()

void trBase::Vec2ub::Set ( value_type  x,
value_type  y 
)

Sets the initial values of the vector.

◆ ToString()

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

Convert this object into a string representation.

Returns
A std::string that represents this object.

◆ X() [1/2]

value_type& trBase::Vec2ub::X ( )

Returns the X component of the vector.

◆ X() [2/2]

value_type trBase::Vec2ub::X ( ) const

Returns the X component of the vector.

◆ Y() [1/2]

value_type& trBase::Vec2ub::Y ( )

Returns the Y component of the vector.

◆ Y() [2/2]

value_type trBase::Vec2ub::Y ( ) const

Returns the Y component of the vector.

Member Data Documentation

◆ mVec

osg::Vec2ub trBase::Vec2ub::mVec
protected

Definition at line 263 of file Vec2ub.h.

◆ NUM_OF_COMPONENTS

const int trBase::Vec2ub::NUM_OF_COMPONENTS
static

Definition at line 46 of file Vec2ub.h.


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