Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SbVec3d Class Reference

VSG extension 3D vector class (double precision). More...

#include <Inventor/SbVec.h>

Public Member Functions

 SbVec3d ()
 Default constructor.
 
 SbVec3d (const double v[3])
 Constructor given vector components.
 
 SbVec3d (double x, double y, double z)
 Constructor given vector components.
 
 SbVec3d (SbPlane &p0, SbPlane &p1, SbPlane &p2)
 Constructor given 3 planes.
 
SbVec3d cross (const SbVec3d &v) const
 Returns right-handed cross product of vector and another vector.
 
double dot (const SbVec3d &v) const
 Returns dot (inner) product of vector and another vector.
 
const double * getValue () const
 Returns vector components.
 
void getValue (double &x, double &y, double &z) const
 Returns vector components.
 
double length () const
 Returns geometric length of vector.
 
double lengthSquared () const
 Returns square length of vector.
 
double normalize ()
 Changes vector to be unit length, returning the length before normalization.
 
void negate ()
 Negates each component of vector in place.
 
SbVec3dsetValue (const double v[3])
 Sets the vector components.
 
SbVec3dsetValue (double x, double y, double z)
 Sets the vector components.
 
SbVec3dsetValue (const SbVec3d &barycentic, const SbVec3d &v0, const SbVec3d &v1, const SbVec3d &v2)
 Sets value of vector as the weighted average of 3 other vectors.
 
SbVec3dsetValue (const SbVec3f &vec3f)
 Sets value of vector from a single precision vector.
 
double & operator[] (int i)
 Accesses indexed component of vector.
 
const double & operator[] (int i) const
 
SbVec3doperator*= (double d)
 Component-wise scalar multiplication operator.
 
SbVec3doperator/= (double d)
 Component-wise scalar division operator.
 
SbVec3doperator+= (const SbVec3d &v)
 Component-wise vector addition operator.
 
SbVec3doperator-= (const SbVec3d &v)
 Component-wise vector subtraction operator.
 
SbVec3d operator- () const
 Nondestructive unary negation - returns a new vector.
 
SbVec3d operator* (const SbVec3d &v) const
 Component-wise vector multiplication operator.
 
SbVec3doperator*= (const SbVec3d &v)
 Component-wise vector multiplication operator.
 
SbBool equals (const SbVec3d &v, double tolerance) const
 Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.
 
SbVec3d getClosestAxis () const
 Returns principal axis that is closest (based on maximum dot product) to this vector.
 
template<typename T >
 SbVec3d (const T &v)
 Constructor that converts an arbitrary SbVec3 to an SbVec3d.
 

Friends

SbVec3d operator* (const SbVec3d &v, double d)
 Component-wise binary scalar multiplication operator.
 
SbVec3d operator* (double d, const SbVec3d &v)
 Component-wise binary scalar multiplication operator.
 
SbVec3d operator/ (const SbVec3d &v, double d)
 Component-wise binary scalar division operator.
 
SbVec3d operator+ (const SbVec3d &v1, const SbVec3d &v2)
 Component-wise binary vector addition operator.
 
SbVec3d operator- (const SbVec3d &v1, const SbVec3d &v2)
 Component-wise binary vector subtraction operator.
 
int operator== (const SbVec3d &v1, const SbVec3d &v2)
 Equality comparison operator.
 
int operator!= (const SbVec3d &v1, const SbVec3d &v2)
 Inequality comparison operator.
 
std::ostream & operator<< (std::ostream &os, const SbVec3d &v)
 Writes the vector to the specified output stream.
 

Detailed Description

VSG extension 3D vector class (double precision).

3D vector class used to store 3D vectors and points. Although Open Inventor fields still store only single precision values, for certain applications it is useful and convenient to be able to store and manipulate double precision values, for example, double precision coordinate data or values that will be used for further computation.

SEE ALSO

SbRotation, SbRotationd, SbVec2d, SbVec2f, SbVec2i32, SbVec2s, SbVec3f, SbVec3i32, SbVec3s, SbVec4b, SbVec4d, SbVec4f, SbVec4i32, SbVec4s, SbVec4ub, SbVec4ui32, SbVec4us

Definition at line 1214 of file SbVec.h.

Constructor & Destructor Documentation

◆ SbVec3d() [1/5]

SbVec3d::SbVec3d ( )
inline

Default constructor.

The vector is initialized with zeros.

Definition at line 1219 of file SbVec.h.

◆ SbVec3d() [2/5]

SbVec3d::SbVec3d ( const double  v[3])
inlineexplicit

Constructor given vector components.

Definition at line 1224 of file SbVec.h.

◆ SbVec3d() [3/5]

SbVec3d::SbVec3d ( double  x,
double  y,
double  z 
)
inline

Constructor given vector components.

Definition at line 1230 of file SbVec.h.

◆ SbVec3d() [4/5]

SbVec3d::SbVec3d ( SbPlane p0,
SbPlane p1,
SbPlane p2 
)

Constructor given 3 planes.

◆ SbVec3d() [5/5]

template<typename T >
SbVec3d::SbVec3d ( const T &  v)
inlineexplicit

Constructor that converts an arbitrary SbVec3 to an SbVec3d.

Definition at line 1456 of file SbVec.h.

Member Function Documentation

◆ cross()

SbVec3d SbVec3d::cross ( const SbVec3d v) const
inline

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

Definition at line 1241 of file SbVec.h.

◆ dot()

double SbVec3d::dot ( const SbVec3d v) const
inline

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

Definition at line 1253 of file SbVec.h.

◆ equals()

SbBool SbVec3d::equals ( const SbVec3d v,
double  tolerance 
) const

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

◆ getClosestAxis()

SbVec3d SbVec3d::getClosestAxis ( ) const

Returns principal axis that is closest (based on maximum dot product) to this vector.

◆ getValue() [1/2]

const double * SbVec3d::getValue ( ) const
inline

Returns vector components.

Definition at line 1259 of file SbVec.h.

◆ getValue() [2/2]

void SbVec3d::getValue ( double &  x,
double &  y,
double &  z 
) const

Returns vector components.

◆ length()

double SbVec3d::length ( ) const

Returns geometric length of vector.

◆ lengthSquared()

double SbVec3d::lengthSquared ( ) const
inline

Returns square length of vector.

Faster than length().

Definition at line 1276 of file SbVec.h.

◆ negate()

void SbVec3d::negate ( )

Negates each component of vector in place.

◆ normalize()

double SbVec3d::normalize ( )

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

◆ operator*()

SbVec3d SbVec3d::operator* ( const SbVec3d v) const
inline

Component-wise vector multiplication operator.

Definition at line 1381 of file SbVec.h.

◆ operator*=() [1/2]

SbVec3d & SbVec3d::operator*= ( const SbVec3d v)
inline

Component-wise vector multiplication operator.

Definition at line 1387 of file SbVec.h.

◆ operator*=() [2/2]

SbVec3d & SbVec3d::operator*= ( double  d)
inline

Component-wise scalar multiplication operator.

Definition at line 1326 of file SbVec.h.

◆ operator+=()

SbVec3d & SbVec3d::operator+= ( const SbVec3d v)
inline

Component-wise vector addition operator.

Definition at line 1350 of file SbVec.h.

◆ operator-()

SbVec3d SbVec3d::operator- ( ) const
inline

Nondestructive unary negation - returns a new vector.

Definition at line 1375 of file SbVec.h.

◆ operator-=()

SbVec3d & SbVec3d::operator-= ( const SbVec3d v)
inline

Component-wise vector subtraction operator.

Definition at line 1362 of file SbVec.h.

◆ operator/=()

SbVec3d & SbVec3d::operator/= ( double  d)
inline

Component-wise scalar division operator.

Definition at line 1338 of file SbVec.h.

◆ operator[]() [1/2]

double & SbVec3d::operator[] ( int  i)
inline

Accesses indexed component of vector.

Definition at line 1319 of file SbVec.h.

◆ operator[]() [2/2]

const double & SbVec3d::operator[] ( int  i) const
inline

Definition at line 1320 of file SbVec.h.

◆ setValue() [1/4]

SbVec3d & SbVec3d::setValue ( const double  v[3])
inline

Sets the vector components.

Definition at line 1292 of file SbVec.h.

◆ setValue() [2/4]

SbVec3d & SbVec3d::setValue ( const SbVec3d barycentic,
const SbVec3d v0,
const SbVec3d v1,
const SbVec3d v2 
)

Sets value of vector as the weighted average of 3 other vectors.

◆ setValue() [3/4]

SbVec3d & SbVec3d::setValue ( const SbVec3f vec3f)
inline

Sets value of vector from a single precision vector.

Definition at line 1312 of file SbVec.h.

◆ setValue() [4/4]

SbVec3d & SbVec3d::setValue ( double  x,
double  y,
double  z 
)
inline

Sets the vector components.

Definition at line 1298 of file SbVec.h.

Friends And Related Symbol Documentation

◆ operator!=

int operator!= ( const SbVec3d v1,
const SbVec3d v2 
)
friend

Inequality comparison operator.

Definition at line 1432 of file SbVec.h.

◆ operator* [1/2]

SbVec3d operator* ( const SbVec3d v,
double  d 
)
friend

Component-wise binary scalar multiplication operator.

Definition at line 1396 of file SbVec.h.

◆ operator* [2/2]

SbVec3d operator* ( double  d,
const SbVec3d v 
)
friend

Component-wise binary scalar multiplication operator.

Definition at line 1402 of file SbVec.h.

◆ operator+

SbVec3d operator+ ( const SbVec3d v1,
const SbVec3d v2 
)
friend

Component-wise binary vector addition operator.

Definition at line 1414 of file SbVec.h.

◆ operator-

SbVec3d operator- ( const SbVec3d v1,
const SbVec3d v2 
)
friend

Component-wise binary vector subtraction operator.

Definition at line 1420 of file SbVec.h.

◆ operator/

SbVec3d operator/ ( const SbVec3d v,
double  d 
)
friend

Component-wise binary scalar division operator.

Definition at line 1408 of file SbVec.h.

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const SbVec3d v 
)
friend

Writes the vector to the specified output stream.

Definition at line 3644 of file SbVec.h.

◆ operator==

int operator== ( const SbVec3d v1,
const SbVec3d v2 
)
friend

Equality comparison operator.

Definition at line 1426 of file SbVec.h.


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