Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SbVec4f Class Reference

4D vector class. More...

#include <Inventor/SbVec.h>

+ Inheritance diagram for SbVec4f:

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.
 
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.
 
float lengthSquared () const
 Returns square 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.
 
SbVec4fsetValue (const SbVec4d &vec4d)
 Sets value of vector from a double precision vector.
 
float & operator[] (int i)
 Accesses indexed component of vector.
 
const float & operator[] (int i) const
 
SbVec4foperator*= (float d)
 Component-wise scalar multiplication operator.
 
SbVec4foperator/= (float d)
 Component-wise scalar division operator.
 
SbVec4foperator+= (const SbVec4f &u)
 Component-wise vector addition operator.
 
SbVec4foperator-= (const SbVec4f &u)
 Component-wise vector subtraction operator.
 
SbVec4f operator- () const
 Nondestructive unary negation - returns a new vector.
 
SbBool equals (const SbVec4f &v, float tolerance) const
 Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.
 
template<typename T >
 SbVec4f (const T &v)
 Constructor that converts an arbitrary SbVec4 to an SbVec4f.
 

Friends

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

Detailed Description

4D vector class.

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

SEE ALSO

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

Definition at line 2214 of file SbVec.h.

Constructor & Destructor Documentation

◆ SbVec4f() [1/4]

SbVec4f::SbVec4f ( )
inline

Default constructor.

The vector is initialized with zeros.

Definition at line 2220 of file SbVec.h.

◆ SbVec4f() [2/4]

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

Constructor given vector components.

Definition at line 2225 of file SbVec.h.

◆ SbVec4f() [3/4]

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

Constructor given vector components.

Definition at line 2230 of file SbVec.h.

◆ SbVec4f() [4/4]

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

Constructor that converts an arbitrary SbVec4 to an SbVec4f.

Definition at line 2371 of file SbVec.h.

Member Function Documentation

◆ dot()

float SbVec4f::dot ( const SbVec4f v) const
inline

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

Definition at line 2235 of file SbVec.h.

◆ equals()

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

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

◆ getReal()

void SbVec4f::getReal ( SbVec3f v) const

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

◆ getValue() [1/2]

const float * SbVec4f::getValue ( ) const
inline

Returns vector components.

Definition at line 2246 of file SbVec.h.

◆ getValue() [2/2]

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

Returns vector components.

◆ length()

float SbVec4f::length ( ) const

Returns geometric length of vector.

◆ lengthSquared()

float SbVec4f::lengthSquared ( ) const
inline

Returns square length of vector.

Faster than length().

Definition at line 2262 of file SbVec.h.

◆ negate()

void SbVec4f::negate ( )

Negates each component of vector in place.

◆ normalize()

float SbVec4f::normalize ( )

Changes vector to be unit length.

◆ operator*=()

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

Component-wise scalar multiplication operator.

◆ operator+=()

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

Component-wise vector addition operator.

◆ operator-()

SbVec4f SbVec4f::operator- ( ) const

Nondestructive unary negation - returns a new vector.

◆ operator-=()

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

Component-wise vector subtraction operator.

◆ operator/=()

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

Component-wise scalar division operator.

◆ operator[]() [1/2]

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

Accesses indexed component of vector.

Definition at line 2294 of file SbVec.h.

◆ operator[]() [2/2]

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

Definition at line 2295 of file SbVec.h.

◆ setValue() [1/3]

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

Sets the vector components.

◆ setValue() [2/3]

SbVec4f & SbVec4f::setValue ( const SbVec4d vec4d)

Sets value of vector from a double precision vector.

◆ setValue() [3/3]

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

Sets the vector components.

Friends And Related Symbol Documentation

◆ operator!=

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

Inequality comparison operator.

Definition at line 2353 of file SbVec.h.

◆ operator* [1/2]

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

Component-wise binary scalar multiplication operator.

◆ operator* [2/2]

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

Component-wise binary scalar multiplication operator.

Definition at line 2329 of file SbVec.h.

◆ operator+

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

Component-wise binary vector addition operator.

◆ operator-

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

Component-wise binary vector subtraction operator.

◆ operator/

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

Component-wise binary scalar division operator.

◆ operator<<

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

Writes the vector to the specified output stream.

Definition at line 3677 of file SbVec.h.

◆ operator==

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

Equality comparison operator.


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