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

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

#include <Inventor/SbVec.h>

Public Member Functions

 SbVec4d ()
 Default constructor.
 
 SbVec4d (const double v[4])
 Constructor given vector components.
 
 SbVec4d (double x, double y, double z, double w)
 Constructor given vector components.
 
double dot (const SbVec4d &v) const
 Returns dot (inner) product of vector and another vector.
 
void getReal (SbVec3d &v) const
 Returns the real portion of the vector by dividing by the fourth value.
 
const double * getValue () const
 Returns vector components.
 
void getValue (double &x, double &y, double &z, double &w) const
 Returns vector components.
 
double length () const
 Returns geometric length of vector.
 
double lengthSquared () const
 Returns square length of vector.
 
void negate ()
 Negates each component of vector in place.
 
double normalize ()
 Changes vector to be unit length.
 
SbVec4dsetValue (const double v[4])
 Sets the vector components.
 
SbVec4dsetValue (double x, double y, double z, double w)
 Sets the vector components.
 
SbVec4dsetValue (const SbVec4f &vec4f)
 Sets value of vector from a single precision vector.
 
double & operator[] (int i)
 Accesses indexed component of vector.
 
const double & operator[] (int i) const
 
SbVec4doperator*= (double d)
 Component-wise scalar multiplication operator.
 
SbVec4doperator/= (double d)
 Component-wise scalar division operator.
 
SbVec4doperator+= (const SbVec4d &u)
 Component-wise vector addition operator.
 
SbVec4doperator-= (const SbVec4d &u)
 Component-wise vector subtraction operator.
 
SbVec4d operator- () const
 Nondestructive unary negation - returns a new vector.
 
SbBool equals (const SbVec4d &v, double tolerance) const
 Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.
 
template<typename T >
 SbVec4d (const T &v)
 Constructor that converts an arbitrary SbVec4 to an SbVec4d.
 

Friends

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

Detailed Description

VSG extension 4D vector class (double precision).

4D vector class used to store homogeneous coordinates. 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, SbVec3d, SbVec3f, SbVec3i32, SbVec3s, SbVec4b, SbVec4f, SbVec4i32, SbVec4s, SbVec4ub, SbVec4ui32, SbVec4us

Definition at line 2427 of file SbVec.h.

Constructor & Destructor Documentation

◆ SbVec4d() [1/4]

SbVec4d::SbVec4d ( )
inline

Default constructor.

The vector is initialized with zeros.

Definition at line 2433 of file SbVec.h.

◆ SbVec4d() [2/4]

SbVec4d::SbVec4d ( const double  v[4])
inlineexplicit

Constructor given vector components.

Definition at line 2438 of file SbVec.h.

◆ SbVec4d() [3/4]

SbVec4d::SbVec4d ( double  x,
double  y,
double  z,
double  w 
)
inline

Constructor given vector components.

Definition at line 2443 of file SbVec.h.

◆ SbVec4d() [4/4]

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

Constructor that converts an arbitrary SbVec4 to an SbVec4d.

Definition at line 2586 of file SbVec.h.

Member Function Documentation

◆ dot()

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

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

Definition at line 2448 of file SbVec.h.

◆ equals()

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

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

◆ getReal()

void SbVec4d::getReal ( SbVec3d v) const

Returns the real portion of the vector by dividing by the fourth value.

◆ getValue() [1/2]

const double * SbVec4d::getValue ( ) const
inline

Returns vector components.

Definition at line 2459 of file SbVec.h.

◆ getValue() [2/2]

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

Returns vector components.

◆ length()

double SbVec4d::length ( ) const

Returns geometric length of vector.

◆ lengthSquared()

double SbVec4d::lengthSquared ( ) const
inline

Returns square length of vector.

Faster than length().

Definition at line 2475 of file SbVec.h.

◆ negate()

void SbVec4d::negate ( )

Negates each component of vector in place.

◆ normalize()

double SbVec4d::normalize ( )

Changes vector to be unit length.

◆ operator*=()

SbVec4d & SbVec4d::operator*= ( double  d)

Component-wise scalar multiplication operator.

◆ operator+=()

SbVec4d & SbVec4d::operator+= ( const SbVec4d u)

Component-wise vector addition operator.

◆ operator-()

SbVec4d SbVec4d::operator- ( ) const

Nondestructive unary negation - returns a new vector.

◆ operator-=()

SbVec4d & SbVec4d::operator-= ( const SbVec4d u)

Component-wise vector subtraction operator.

◆ operator/=()

SbVec4d & SbVec4d::operator/= ( double  d)

Component-wise scalar division operator.

◆ operator[]() [1/2]

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

Accesses indexed component of vector.

Definition at line 2509 of file SbVec.h.

◆ operator[]() [2/2]

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

Definition at line 2510 of file SbVec.h.

◆ setValue() [1/3]

SbVec4d & SbVec4d::setValue ( const double  v[4])

Sets the vector components.

◆ setValue() [2/3]

SbVec4d & SbVec4d::setValue ( const SbVec4f vec4f)
inline

Sets value of vector from a single precision vector.

Definition at line 2501 of file SbVec.h.

◆ setValue() [3/3]

SbVec4d & SbVec4d::setValue ( double  x,
double  y,
double  z,
double  w 
)

Sets the vector components.

Friends And Related Symbol Documentation

◆ operator!=

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

Inequality comparison operator.

Definition at line 2568 of file SbVec.h.

◆ operator* [1/2]

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

Component-wise binary scalar multiplication operator.

◆ operator* [2/2]

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

Component-wise binary scalar multiplication operator.

Definition at line 2544 of file SbVec.h.

◆ operator+

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

Component-wise binary vector addition operator.

◆ operator-

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

Component-wise binary vector subtraction operator.

◆ operator/

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

Component-wise binary scalar division operator.

◆ operator<<

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

Writes the vector to the specified output stream.

Definition at line 3669 of file SbVec.h.

◆ operator==

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

Equality comparison operator.


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