Open Inventor Reference
SbVec2f Class Reference

2D vector class. More...

#include <Inventor/SbLinear.h>

List of all members.

Public Member Functions

 SbVec2f ()
 Default constructor.
 SbVec2f (const float v[2])
 Constructor given vector components.
 SbVec2f (float x, float y)
 Constructor given vector components.
float dot (const SbVec2f &v) const
 Returns dot (inner) product of vector and another vector.
const float * getValue () const
 Returns vector components.
void getValue (float &x, float &y) 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.
SbVec2fsetValue (const float v[2])
 Sets the vector components.
SbVec2fsetValue (float x, float y)
 Sets the vector components.
float & operator[] (int i)
 Accesses indexed component of vector.
const float & operator[] (int i) const
SbVec2foperator*= (float d)
 Component-wise scalar multiplication and division operators.
SbVec2foperator/= (float d)
 Component-wise scalar multiplication and division operators.
SbVec2foperator+= (const SbVec2f &u)
 Component-wise vector addition and subtraction operators.
SbVec2foperator-= (const SbVec2f &u)
 Component-wise vector addition and subtraction operators.
SbVec2f operator- () const
 Nondestructive unary negation - returns a new vector.
SbBool equals (const SbVec2f 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 [2]
 Storage for vector components.

Friends

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

Detailed Description

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

See Also
SbVec3f, SbVec4f, SbVec2s, SbRotation

Definition at line 237 of file SbLinear.h.


Constructor & Destructor Documentation

SbVec2f::SbVec2f ( ) [inline]

Definition at line 241 of file SbLinear.h.

SbVec2f::SbVec2f ( const float  v[2]) [inline]

Definition at line 244 of file SbLinear.h.

SbVec2f::SbVec2f ( float  x,
float  y 
) [inline]

Definition at line 247 of file SbLinear.h.


Member Function Documentation

float SbVec2f::dot ( const SbVec2f v) const
SbBool SbVec2f::equals ( const SbVec2f  v,
float  tolerance 
) const
const float* SbVec2f::getValue ( ) const [inline]

Definition at line 253 of file SbLinear.h.

Referenced by SbBox2f::getBounds().

void SbVec2f::getValue ( float &  x,
float &  y 
) const
float SbVec2f::length ( ) const
void SbVec2f::negate ( )
float SbVec2f::normalize ( )
SbVec2f& SbVec2f::operator*= ( float  d)
SbVec2f& SbVec2f::operator+= ( const SbVec2f u)
SbVec2f SbVec2f::operator- ( ) const
SbVec2f& SbVec2f::operator-= ( const SbVec2f u)
SbVec2f& SbVec2f::operator/= ( float  d) [inline]

Definition at line 281 of file SbLinear.h.

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

Definition at line 275 of file SbLinear.h.

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

Definition at line 274 of file SbLinear.h.

SbVec2f& SbVec2f::setValue ( const float  v[2])
SbVec2f& SbVec2f::setValue ( float  x,
float  y 
)

Friends And Related Function Documentation

INVENTOR_API int operator!= ( const SbVec2f v1,
const SbVec2f v2 
) [friend]

Definition at line 306 of file SbLinear.h.

INVENTOR_API SbVec2f operator* ( float  d,
const SbVec2f v 
) [friend]

Definition at line 294 of file SbLinear.h.

INVENTOR_API SbVec2f operator* ( const SbVec2f v,
float  d 
) [friend]
INVENTOR_API SbVec2f operator+ ( const SbVec2f v1,
const SbVec2f v2 
) [friend]
INVENTOR_API SbVec2f operator- ( const SbVec2f v1,
const SbVec2f v2 
) [friend]
INVENTOR_API SbVec2f operator/ ( const SbVec2f v,
float  d 
) [friend]

Definition at line 296 of file SbLinear.h.

INVENTOR_API int operator== ( const SbVec2f v1,
const SbVec2f v2 
) [friend]

Member Data Documentation

float SbVec2f::vec[2] [protected]

Definition at line 314 of file SbLinear.h.


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