Open Inventor Reference
SbVec3f Class Reference

3D vector class. More...

#include <Inventor/SbLinear.h>

Inheritance diagram for SbVec3f:
SbColor

Public Member Functions

 SbVec3f ()
 Default constructor. More...
 
 SbVec3f (const float v[3])
 Constructor given vector components. More...
 
 SbVec3f (float x, float y, float z)
 Constructor given vector components. More...
 
 SbVec3f (SbPlane &p0, SbPlane &p1, SbPlane &p2)
 Constructor given 3 planes. More...
 
SbVec3f cross (const SbVec3f &v) const
 Returns right-handed cross product of vector and another vector. More...
 
float dot (const SbVec3f &v) const
 Returns dot (inner) product of vector and another vector. More...
 
const float * getValue () const
 Returns vector components. More...
 
void getValue (float &x, float &y, float &z) const
 Returns vector components. More...
 
float length () const
 Returns geometric length of vector. More...
 
float normalize ()
 Changes vector to be unit length, returning the length before normalization. More...
 
void negate ()
 Negates each component of vector in place. More...
 
SbVec3fsetValue (const float v[3])
 Sets the vector components. More...
 
SbVec3fsetValue (float x, float y, float z)
 Sets the vector components. More...
 
SbVec3fsetValue (const SbVec3f &barycentic, const SbVec3f &v0, const SbVec3f &v1, const SbVec3f &v2)
 Sets value of vector to be convex combination of 3 other vectors, using barycentic coordinates. More...
 
float & operator[] (int i)
 Accesses indexed component of vector. More...
 
const float & operator[] (int i) const
 
SbVec3foperator*= (float d)
 Component-wise scalar multiplication and division operators. More...
 
SbVec3foperator/= (float d)
 Component-wise scalar multiplication and division operators. More...
 
SbVec3foperator+= (SbVec3f v)
 Component-wise vector addition and subtraction operators. More...
 
SbVec3foperator-= (SbVec3f v)
 Component-wise vector addition and subtraction operators. More...
 
SbVec3f operator- () const
 Nondestructive unary negation - returns a new vector. More...
 
bool equals (const SbVec3f v, float tolerance) const
 Equality comparison within given tolerance em the square of the length of the maximum distance between the two vectors. More...
 
SbVec3f getClosestAxis () const
 Returns principal axis that is closest (based on maximum dot product) to this vector. More...
 

Protected Attributes

float vec [3]
 Storage for vector components. More...
 

Friends

INVENTOR_API SbVec3f operator* (const SbVec3f &v, float d)
 Component-wise binary scalar multiplication and division operators. More...
 
INVENTOR_API SbVec3f operator* (float d, const SbVec3f &v)
 
INVENTOR_API SbVec3f operator/ (const SbVec3f &v, float d)
 
INVENTOR_API SbVec3f operator+ (const SbVec3f &v1, const SbVec3f &v2)
 Component-wise binary vector addition and subtraction operators. More...
 
INVENTOR_API SbVec3f operator- (const SbVec3f &v1, const SbVec3f &v2)
 
INVENTOR_API bool operator== (const SbVec3f &v1, const SbVec3f &v2)
 Equality comparison operator. More...
 
INVENTOR_API bool operator!= (const SbVec3f &v1, const SbVec3f &v2)
 

Detailed Description

3D vector class used to store 3D vectors and points. This class is used throughout Inventor for arguments and return values. {}

See Also
SbVec2f, SbVec4f, SbVec2s, SbRotation

Definition at line 120 of file SbLinear.h.

Constructor & Destructor Documentation

◆ SbVec3f() [1/4]

SbVec3f::SbVec3f ( )
inline

Definition at line 124 of file SbLinear.h.

◆ SbVec3f() [2/4]

SbVec3f::SbVec3f ( const float  v[3])
inline

Definition at line 127 of file SbLinear.h.

◆ SbVec3f() [3/4]

SbVec3f::SbVec3f ( float  x,
float  y,
float  z 
)
inline

Definition at line 131 of file SbLinear.h.

◆ SbVec3f() [4/4]

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

Member Function Documentation

◆ cross()

SbVec3f SbVec3f::cross ( const SbVec3f v) const

◆ dot()

float SbVec3f::dot ( const SbVec3f v) const

◆ equals()

bool SbVec3f::equals ( const SbVec3f  v,
float  tolerance 
) const

◆ getClosestAxis()

SbVec3f SbVec3f::getClosestAxis ( ) const

◆ getValue() [1/2]

const float* SbVec3f::getValue ( ) const
inline

Definition at line 144 of file SbLinear.h.

Referenced by SbVec3fList::append(), SbVec3fList::insert(), and SbColor::SbColor().

◆ getValue() [2/2]

void SbVec3f::getValue ( float &  x,
float &  y,
float &  z 
) const

◆ length()

float SbVec3f::length ( ) const

◆ negate()

void SbVec3f::negate ( )

◆ normalize()

float SbVec3f::normalize ( )

◆ operator*=()

SbVec3f& SbVec3f::operator*= ( float  d)

◆ operator+=()

SbVec3f& SbVec3f::operator+= ( SbVec3f  v)

◆ operator-()

SbVec3f SbVec3f::operator- ( ) const

◆ operator-=()

SbVec3f& SbVec3f::operator-= ( SbVec3f  v)

◆ operator/=()

SbVec3f& SbVec3f::operator/= ( float  d)
inline

Definition at line 179 of file SbLinear.h.

◆ operator[]() [1/2]

float& SbVec3f::operator[] ( int  i)
inline

Definition at line 172 of file SbLinear.h.

◆ operator[]() [2/2]

const float& SbVec3f::operator[] ( int  i) const
inline

Definition at line 173 of file SbLinear.h.

◆ setValue() [1/3]

SbVec3f& SbVec3f::setValue ( const float  v[3])
inline

Definition at line 159 of file SbLinear.h.

Referenced by SbColor::SbColor().

◆ setValue() [2/3]

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

◆ setValue() [3/3]

SbVec3f& SbVec3f::setValue ( float  x,
float  y,
float  z 
)
inline

Definition at line 163 of file SbLinear.h.

Friends And Related Function Documentation

◆ operator!=

INVENTOR_API bool operator!= ( const SbVec3f v1,
const SbVec3f v2 
)
friend

Definition at line 225 of file SbLinear.h.

◆ operator* [1/2]

INVENTOR_API SbVec3f operator* ( const SbVec3f v,
float  d 
)
friend

◆ operator* [2/2]

INVENTOR_API SbVec3f operator* ( float  d,
const SbVec3f v 
)
friend

Definition at line 217 of file SbLinear.h.

◆ operator+

INVENTOR_API SbVec3f operator+ ( const SbVec3f v1,
const SbVec3f v2 
)
friend

◆ operator-

INVENTOR_API SbVec3f operator- ( const SbVec3f v1,
const SbVec3f v2 
)
friend

◆ operator/

INVENTOR_API SbVec3f operator/ ( const SbVec3f v,
float  d 
)
friend

Definition at line 219 of file SbLinear.h.

◆ operator==

INVENTOR_API bool operator== ( const SbVec3f v1,
const SbVec3f v2 
)
friend

Member Data Documentation

◆ vec

float SbVec3f::vec[3]
protected

Definition at line 213 of file SbLinear.h.


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