Open Inventor Reference
SbVec4f Class Reference

4D vector class. More...

#include <Inventor/SbLinear.h>

Public Member Functions

 SbVec4f ()
 Default constructor.
 
 SbVec4f (const float v[4])
 Constructor given vector components.
 
 SbVec4f (float x, float y, float z, float w)
 Constructor given vector components.
 
float dot (const SbVec4f &v) const
 Returns dot (inner) product of vector and another vector.
 
void getReal (SbVec3f &v) const
 Returns the real portion of the vector by dividing by the fourth value.
 
SbVec3f getReal () const
 Returns the real portion of the vector by dividing by the fourth value.
 
const float * getValue () const
 Returns vector components.
 
void getValue (float &x, float &y, float &z, float &w) const
 Returns vector components.
 
float length () const
 Returns geometric length of vector.
 
void negate ()
 Negates each component of vector in place.
 
float normalize ()
 Changes vector to be unit length.
 
SbVec4fsetValue (const float v[4])
 Sets the vector components.
 
SbVec4fsetValue (float x, float y, float z, float w)
 Sets the vector components.
 
float & operator[] (int i)
 Accesses indexed component of vector.
 
const float & operator[] (int i) const
 
SbVec4foperator*= (float d)
 Component-wise scalar multiplication and division operators.
 
SbVec4foperator/= (float d)
 Component-wise scalar multiplication and division operators.
 
SbVec4foperator+= (const SbVec4f &u)
 Component-wise vector addition and subtraction operators.
 
SbVec4foperator-= (const SbVec4f &u)
 Component-wise vector addition and subtraction operators.
 
SbVec4f operator- () const
 Nondestructive unary negation - returns a new vector.
 
bool equals (const SbVec4f v, float tolerance) const
 Equality comparison within given tolerance em the square of the length of the maximum distance between the two vectors.
 

Protected Attributes

float vec [4]
 Storage for vector components.
 

Friends

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

Detailed Description

4D vector class used to store homogeneous coordinates. This class is used in Inventor for arguments and return values. {}

See Also
SbVec2f, SbVec3f, SbVec2s, SbRotation

Definition at line 559 of file SbLinear.h.

Constructor & Destructor Documentation

◆ SbVec4f() [1/3]

SbVec4f::SbVec4f ( )
inline

Definition at line 563 of file SbLinear.h.

◆ SbVec4f() [2/3]

SbVec4f::SbVec4f ( const float  v[4])
inline

Definition at line 566 of file SbLinear.h.

◆ SbVec4f() [3/3]

SbVec4f::SbVec4f ( float  x,
float  y,
float  z,
float  w 
)
inline

Definition at line 569 of file SbLinear.h.

Member Function Documentation

◆ dot()

float SbVec4f::dot ( const SbVec4f v) const

◆ equals()

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

◆ getReal() [1/2]

SbVec3f SbVec4f::getReal ( ) const
inline

Definition at line 578 of file SbLinear.h.

References getReal().

Referenced by getReal().

◆ getReal() [2/2]

void SbVec4f::getReal ( SbVec3f v) const

◆ getValue() [1/2]

const float * SbVec4f::getValue ( ) const
inline

Definition at line 581 of file SbLinear.h.

◆ getValue() [2/2]

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

◆ length()

float SbVec4f::length ( ) const

◆ negate()

void SbVec4f::negate ( )

◆ normalize()

float SbVec4f::normalize ( )

◆ operator*=()

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

◆ operator+=()

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

◆ operator-()

SbVec4f SbVec4f::operator- ( ) const

◆ operator-=()

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

◆ operator/=()

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

Definition at line 609 of file SbLinear.h.

◆ operator[]() [1/2]

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

Definition at line 602 of file SbLinear.h.

◆ operator[]() [2/2]

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

Definition at line 603 of file SbLinear.h.

◆ setValue() [1/2]

SbVec4f & SbVec4f::setValue ( const float  v[4])

◆ setValue() [2/2]

SbVec4f & SbVec4f::setValue ( float  x,
float  y,
float  z,
float  w 
)

Friends And Related Symbol Documentation

◆ operator!=

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

Definition at line 653 of file SbLinear.h.

◆ operator* [1/2]

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

◆ operator* [2/2]

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

Definition at line 643 of file SbLinear.h.

◆ operator+

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

◆ operator-

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

◆ operator/

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

Definition at line 645 of file SbLinear.h.

◆ operator==

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

Member Data Documentation

◆ vec

float SbVec4f::vec[4]
protected

Definition at line 639 of file SbLinear.h.


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