Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
MbVec3< _T > Class Template Reference

MeshViz Class defining a vector or a point of 3 coordinates. More...

#include <MeshVizXLM/MbVec3.h>

Public Types

typedef _T ValueType
 

Public Member Functions

 MbVec3 ()
 Constructor (vector is initialized to zero values)
 
 MbVec3 (const _T v[3])
 Constructor.
 
 MbVec3 (_T x, _T y, _T z)
 Constructor.
 
template<typename _Type >
 MbVec3 (_Type x, _Type y, _Type z)
 
 MbVec3 (char v)
 Constructor.
 
 MbVec3 (unsigned char v)
 Constructor.
 
 MbVec3 (short v)
 Constructor.
 
 MbVec3 (unsigned short v)
 Constructor.
 
 MbVec3 (int v)
 Constructor.
 
 MbVec3 (size_t v)
 Constructor.
 
 MbVec3 (long v)
 Constructor.
 
 MbVec3 (float v)
 Constructor.
 
 MbVec3 (double v)
 Constructor.
 
 MbVec3 (long double v)
 Constructor.
 
template<typename _MbVec3T >
 MbVec3 (const _MbVec3T &v)
 Constructor.
 
MbVec3 cross (const MbVec3< _T > &v) const
 Returns right-handed cross product of vector and another vector.
 
_T dot (const MbVec3< _T > &v) const
 Returns dot (inner) product of vector and another vector.
 
const _T * getValue () const
 Returns pointer to vector components.
 
void getValue (_T &x, _T &y, _T &z) const
 Returns vector components.
 
_T length () const
 Returns geometric length of vector.
 
_T normalize ()
 Changes vector to be unit length, returning the length before normalization.
 
void negate ()
 Negates each component of vector in place.
 
MbVec3 mult (const MbVec3< _T > &v) const
 Component-wise vector multiplication.
 
MbVec3 div (const MbVec3< _T > &v) const
 Component-wise vector division.
 
MbVec3< _T > & setValue (const _T v[3])
 Sets the vector components.
 
MbVec3< _T > & setValue (_T x, _T y, _T z)
 Sets the vector components.
 
_T & operator[] (int i)
 Accesses indexed component of vector.
 
const _T & operator[] (int i) const
 
_T & operator[] (size_t i)
 
const _T & operator[] (size_t i) const
 
MbVec3operator= (_T d)
 Component-wise setting.
 
MbVec3operator*= (_T d)
 Component-wise scalar multiplication operator.
 
MbVec3operator/= (_T d)
 Component-wise scalar division operator.
 
MbVec3operator+= (const MbVec3 &v)
 Component-wise vector addition operator.
 
MbVec3operator-= (const MbVec3 &v)
 Component-wise vector subtraction operator.
 
MbVec3 operator- () const
 Nondestructive unary negation - returns a new vector.
 
bool equals (const MbVec3 &v, _T tolerance) const
 Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.
 
bool equals (const MbVec3 &v) const
 Equality comparison within the machine epsilon given by the numeric_limits<_T> Square of the length of the maximum distance between the two vectors.
 

Static Public Member Functions

static MbVec3 numeric_limit_max ()
 Returns the maximum value for a vector.
 

Friends

MbVec3 operator* (const MbVec3 &v1, const MbVec3 &v2)
 Component-wise vector multiplication operator.
 
MbVec3 operator* (const MbVec3 &v, _T d)
 Component-wise binary scalar multiplication operator.
 
MbVec3 operator* (_T d, const MbVec3 &v)
 Component-wise binary scalar multiplication operator.
 
MbVec3 operator/ (const MbVec3 &v, _T d)
 Component-wise binary scalar division operator.
 
MbVec3 operator/ (const MbVec3 &v1, const MbVec3 &v2)
 Component-wise vector division operator.
 
MbVec3 operator+ (const MbVec3 &v1, const MbVec3 &v2)
 Component-wise binary vector addition operator.
 
MbVec3 operator+ (const MbVec3 &v, _T d)
 Component-wise binary scalar addition operator.
 
MbVec3 operator+ (_T d, const MbVec3 &v)
 Component-wise binary scalar addition operator.
 
MbVec3 operator- (const MbVec3 &v1, const MbVec3 &v2)
 Component-wise binary vector subtraction operator.
 
MbVec3 operator- (const MbVec3 &v, _T d)
 Component-wise binary scalar subtraction operator.
 
MbVec3 sqrt (const MbVec3 &v)
 Component-wise vector square root operator.
 
bool operator== (const MbVec3 &v1, const MbVec3 &v2)
 Equality comparison operator.
 
bool operator!= (const MbVec3 &v1, const MbVec3 &v2)
 Inequality comparison operator.
 
bool operator< (const MbVec3 &v1, const MbVec3 &v2)
 Length comparison operator.
 
bool operator<= (const MbVec3 &v1, const MbVec3 &v2)
 Length comparison operator.
 
bool operator> (const MbVec3 &v1, const MbVec3 &v2)
 Length comparison operator.
 
bool operator>= (const MbVec3 &v1, const MbVec3 &v2)
 Length comparison operator.
 
bool areCollinear (const MbVec3< _T > &v1, const MbVec3< _T > &v2, _T tol)
 Returns true if vectors are collinear within the given tolerance.
 
bool areCollinear (const MbVec3< _T > &v1, const MbVec3< _T > &v2)
 Returns true if vectors are collinear within the machine epsilon given by the numeric_limits<_T>
 
std::ostream & operator<< (std::ostream &os, const MbVec3 &v)
 Writes the vector to the specified output stream.
 

Detailed Description

template<typename _T>
class MbVec3< _T >

MeshViz Class defining a vector or a point of 3 coordinates.

3D vector class used to store 3D vectors and points. This class is similar to the standard Open Inventor SbVec3 classes, but exists to allow MeshViz Extraction to be used independently of Open Inventor.

Definition at line 51 of file MbVec3.h.

Member Typedef Documentation

◆ ValueType

template<typename _T >
typedef _T MbVec3< _T >::ValueType

Definition at line 54 of file MbVec3.h.

Constructor & Destructor Documentation

◆ MbVec3() [1/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( )
inline

Constructor (vector is initialized to zero values)

Definition at line 63 of file MbVec3.h.

◆ MbVec3() [2/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( const _T  v[3])
inline

Constructor.

Definition at line 68 of file MbVec3.h.

◆ MbVec3() [3/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( _T  x,
_T  y,
_T  z 
)
inline

Constructor.

Definition at line 74 of file MbVec3.h.

◆ MbVec3() [4/15]

template<typename _T >
template<typename _Type >
MbVec3< _T >::MbVec3 ( _Type  x,
_Type  y,
_Type  z 
)
inline

Definition at line 80 of file MbVec3.h.

◆ MbVec3() [5/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( char  v)
inlineexplicit

Constructor.

Definition at line 86 of file MbVec3.h.

◆ MbVec3() [6/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( unsigned char  v)
inlineexplicit

Constructor.

Definition at line 92 of file MbVec3.h.

◆ MbVec3() [7/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( short  v)
inlineexplicit

Constructor.

Definition at line 98 of file MbVec3.h.

◆ MbVec3() [8/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( unsigned short  v)
inlineexplicit

Constructor.

Definition at line 104 of file MbVec3.h.

◆ MbVec3() [9/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( int  v)
inlineexplicit

Constructor.

Definition at line 110 of file MbVec3.h.

◆ MbVec3() [10/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( size_t  v)
inlineexplicit

Constructor.

Definition at line 116 of file MbVec3.h.

◆ MbVec3() [11/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( long  v)
inlineexplicit

Constructor.

Definition at line 122 of file MbVec3.h.

◆ MbVec3() [12/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( float  v)
inlineexplicit

Constructor.

Definition at line 136 of file MbVec3.h.

◆ MbVec3() [13/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( double  v)
inlineexplicit

Constructor.

Definition at line 142 of file MbVec3.h.

◆ MbVec3() [14/15]

template<typename _T >
MbVec3< _T >::MbVec3 ( long double  v)
inlineexplicit

Constructor.

Definition at line 148 of file MbVec3.h.

◆ MbVec3() [15/15]

template<typename _T >
template<typename _MbVec3T >
MbVec3< _T >::MbVec3 ( const _MbVec3T &  v)
inlineexplicit

Constructor.

Definition at line 155 of file MbVec3.h.

Member Function Documentation

◆ cross()

template<typename _T >
MbVec3 MbVec3< _T >::cross ( const MbVec3< _T > &  v) const
inline

Returns right-handed cross product of vector and another vector.

Definition at line 165 of file MbVec3.h.

◆ div()

template<typename _T >
MbVec3 MbVec3< _T >::div ( const MbVec3< _T > &  v) const
inline

Component-wise vector division.

Definition at line 225 of file MbVec3.h.

◆ dot()

template<typename _T >
_T MbVec3< _T >::dot ( const MbVec3< _T > &  v) const
inline

Returns dot (inner) product of vector and another vector.

Definition at line 175 of file MbVec3.h.

◆ equals() [1/2]

template<typename _T >
bool MbVec3< _T >::equals ( const MbVec3< _T > &  v) const
inline

Equality comparison within the machine epsilon given by the numeric_limits<_T> Square of the length of the maximum distance between the two vectors.

Definition at line 466 of file MbVec3.h.

◆ equals() [2/2]

template<typename _T >
bool MbVec3< _T >::equals ( const MbVec3< _T > &  v,
_T  tolerance 
) const
inline

Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.

Definition at line 456 of file MbVec3.h.

◆ getValue() [1/2]

template<typename _T >
const _T * MbVec3< _T >::getValue ( ) const
inline

Returns pointer to vector components.

Definition at line 183 of file MbVec3.h.

◆ getValue() [2/2]

template<typename _T >
void MbVec3< _T >::getValue ( _T &  x,
_T &  y,
_T &  z 
) const
inline

Returns vector components.

Definition at line 188 of file MbVec3.h.

◆ length()

template<typename _T >
_T MbVec3< _T >::length ( ) const
inline

Returns geometric length of vector.

Definition at line 196 of file MbVec3.h.

◆ mult()

template<typename _T >
MbVec3 MbVec3< _T >::mult ( const MbVec3< _T > &  v) const
inline

Component-wise vector multiplication.

Definition at line 217 of file MbVec3.h.

◆ negate()

template<typename _T >
void MbVec3< _T >::negate ( )
inline

Negates each component of vector in place.

Definition at line 209 of file MbVec3.h.

◆ normalize()

template<typename _T >
_T MbVec3< _T >::normalize

Changes vector to be unit length, returning the length before normalization.

Definition at line 503 of file MbVec3.h.

◆ numeric_limit_max()

template<typename _T >
static MbVec3 MbVec3< _T >::numeric_limit_max ( )
inlinestatic

Returns the maximum value for a vector.

Definition at line 57 of file MbVec3.h.

◆ operator*=()

template<typename _T >
MbVec3 & MbVec3< _T >::operator*= ( _T  d)
inline

Component-wise scalar multiplication operator.

Definition at line 268 of file MbVec3.h.

◆ operator+=()

template<typename _T >
MbVec3 & MbVec3< _T >::operator+= ( const MbVec3< _T > &  v)
inline

Component-wise vector addition operator.

Definition at line 290 of file MbVec3.h.

◆ operator-()

template<typename _T >
MbVec3 MbVec3< _T >::operator- ( ) const
inline

Nondestructive unary negation - returns a new vector.

Definition at line 313 of file MbVec3.h.

◆ operator-=()

template<typename _T >
MbVec3 & MbVec3< _T >::operator-= ( const MbVec3< _T > &  v)
inline

Component-wise vector subtraction operator.

Definition at line 301 of file MbVec3.h.

◆ operator/=()

template<typename _T >
MbVec3 & MbVec3< _T >::operator/= ( _T  d)
inline

Component-wise scalar division operator.

Definition at line 279 of file MbVec3.h.

◆ operator=()

template<typename _T >
MbVec3 & MbVec3< _T >::operator= ( _T  d)
inline

Component-wise setting.

All components are set to d.

Definition at line 259 of file MbVec3.h.

◆ operator[]() [1/4]

template<typename _T >
_T & MbVec3< _T >::operator[] ( int  i)
inline

Accesses indexed component of vector.

Definition at line 250 of file MbVec3.h.

◆ operator[]() [2/4]

template<typename _T >
const _T & MbVec3< _T >::operator[] ( int  i) const
inline

Definition at line 251 of file MbVec3.h.

◆ operator[]() [3/4]

template<typename _T >
_T & MbVec3< _T >::operator[] ( size_t  i)
inline

Definition at line 252 of file MbVec3.h.

◆ operator[]() [4/4]

template<typename _T >
const _T & MbVec3< _T >::operator[] ( size_t  i) const
inline

Definition at line 253 of file MbVec3.h.

◆ setValue() [1/2]

template<typename _T >
MbVec3< _T > & MbVec3< _T >::setValue ( _T  x,
_T  y,
_T  z 
)
inline

Sets the vector components.

Definition at line 241 of file MbVec3.h.

◆ setValue() [2/2]

template<typename _T >
MbVec3< _T > & MbVec3< _T >::setValue ( const _T  v[3])
inline

Sets the vector components.

Definition at line 233 of file MbVec3.h.

Friends And Related Symbol Documentation

◆ areCollinear [1/2]

template<typename _T >
bool areCollinear ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2 
)
friend

Returns true if vectors are collinear within the machine epsilon given by the numeric_limits<_T>

Definition at line 484 of file MbVec3.h.

◆ areCollinear [2/2]

template<typename _T >
bool areCollinear ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2,
_T  tol 
)
friend

Returns true if vectors are collinear within the given tolerance.

Definition at line 474 of file MbVec3.h.

◆ operator!=

template<typename _T >
bool operator!= ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2 
)
friend

Inequality comparison operator.

Definition at line 415 of file MbVec3.h.

◆ operator* [1/3]

template<typename _T >
MbVec3 operator* ( _T  d,
const MbVec3< _T > &  v 
)
friend

Component-wise binary scalar multiplication operator.

Definition at line 337 of file MbVec3.h.

◆ operator* [2/3]

template<typename _T >
MbVec3 operator* ( const MbVec3< _T > &  v,
_T  d 
)
friend

Component-wise binary scalar multiplication operator.

Definition at line 329 of file MbVec3.h.

◆ operator* [3/3]

template<typename _T >
MbVec3 operator* ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2 
)
friend

Component-wise vector multiplication operator.

Definition at line 321 of file MbVec3.h.

◆ operator+ [1/3]

template<typename _T >
MbVec3 operator+ ( _T  d,
const MbVec3< _T > &  v 
)
friend

Component-wise binary scalar addition operator.

Definition at line 375 of file MbVec3.h.

◆ operator+ [2/3]

template<typename _T >
MbVec3 operator+ ( const MbVec3< _T > &  v,
_T  d 
)
friend

Component-wise binary scalar addition operator.

Definition at line 367 of file MbVec3.h.

◆ operator+ [3/3]

template<typename _T >
MbVec3 operator+ ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2 
)
friend

Component-wise binary vector addition operator.

Definition at line 359 of file MbVec3.h.

◆ operator- [1/2]

template<typename _T >
MbVec3 operator- ( const MbVec3< _T > &  v,
_T  d 
)
friend

Component-wise binary scalar subtraction operator.

Definition at line 391 of file MbVec3.h.

◆ operator- [2/2]

template<typename _T >
MbVec3 operator- ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2 
)
friend

Component-wise binary vector subtraction operator.

Definition at line 383 of file MbVec3.h.

◆ operator/ [1/2]

template<typename _T >
MbVec3 operator/ ( const MbVec3< _T > &  v,
_T  d 
)
friend

Component-wise binary scalar division operator.

Definition at line 343 of file MbVec3.h.

◆ operator/ [2/2]

template<typename _T >
MbVec3 operator/ ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2 
)
friend

Component-wise vector division operator.

Definition at line 351 of file MbVec3.h.

◆ operator<

template<typename _T >
bool operator< ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2 
)
friend

Length comparison operator.

Definition at line 423 of file MbVec3.h.

◆ operator<<

template<typename _T >
std::ostream & operator<< ( std::ostream &  os,
const MbVec3< _T > &  v 
)
friend

Writes the vector to the specified output stream.

Definition at line 492 of file MbVec3.h.

◆ operator<=

template<typename _T >
bool operator<= ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2 
)
friend

Length comparison operator.

Definition at line 431 of file MbVec3.h.

◆ operator==

template<typename _T >
bool operator== ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2 
)
friend

Equality comparison operator.

Definition at line 407 of file MbVec3.h.

◆ operator>

template<typename _T >
bool operator> ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2 
)
friend

Length comparison operator.

Definition at line 439 of file MbVec3.h.

◆ operator>=

template<typename _T >
bool operator>= ( const MbVec3< _T > &  v1,
const MbVec3< _T > &  v2 
)
friend

Length comparison operator.

Definition at line 447 of file MbVec3.h.

◆ sqrt

template<typename _T >
MbVec3 sqrt ( const MbVec3< _T > &  v)
friend

Component-wise vector square root operator.

Definition at line 399 of file MbVec3.h.


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