Open Inventor Reference
SbVec2d Class Reference

2D vector class with double members. More...

#include <Inventor/SbLineard.h>

Public Member Functions

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

Protected Attributes

double vec [2]
 Storage for vector components.
 

Friends

INVENTOR_API SbVec2d operator* (const SbVec2d &v, double d)
 Component-wise binary scalar multiplication and division operators.
 
INVENTOR_API SbVec2d operator* (double d, const SbVec2d &v)
 
INVENTOR_API SbVec2d operator/ (const SbVec2d &v, double d)
 
INVENTOR_API SbVec2d operator+ (const SbVec2d &v1, const SbVec2d &v2)
 Component-wise binary vector addition and subtraction operators.
 
INVENTOR_API SbVec2d operator- (const SbVec2d &v1, const SbVec2d &v2)
 
INVENTOR_API bool operator== (const SbVec2d &v1, const SbVec2d &v2)
 Equality comparison operator.
 
INVENTOR_API bool operator!= (const SbVec2d &v1, const SbVec2d &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, SbVec3f, SbVec4f, SbVec3d, SbVec4d, SbVec2s, SbRotation, SbRotationd

Definition at line 242 of file SbLineard.h.

Constructor & Destructor Documentation

◆ SbVec2d() [1/3]

SbVec2d::SbVec2d ( )
inline

Definition at line 246 of file SbLineard.h.

◆ SbVec2d() [2/3]

SbVec2d::SbVec2d ( const double  v[2])
inline

Definition at line 249 of file SbLineard.h.

◆ SbVec2d() [3/3]

SbVec2d::SbVec2d ( double  x,
double  y 
)
inline

Definition at line 252 of file SbLineard.h.

Member Function Documentation

◆ dot()

double SbVec2d::dot ( const SbVec2d v) const

◆ equals()

bool SbVec2d::equals ( const SbVec2d  v,
double  tolerance 
) const

◆ getValue() [1/2]

const double * SbVec2d::getValue ( ) const
inline

Definition at line 258 of file SbLineard.h.

◆ getValue() [2/2]

void SbVec2d::getValue ( double &  x,
double &  y 
) const

◆ length()

double SbVec2d::length ( ) const

◆ negate()

void SbVec2d::negate ( )

◆ normalize()

double SbVec2d::normalize ( )

◆ operator*=()

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

◆ operator+=()

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

◆ operator-()

SbVec2d SbVec2d::operator- ( ) const

◆ operator-=()

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

◆ operator/=()

SbVec2d & SbVec2d::operator/= ( double  d)
inline

Definition at line 286 of file SbLineard.h.

◆ operator[]() [1/2]

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

Definition at line 279 of file SbLineard.h.

◆ operator[]() [2/2]

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

Definition at line 280 of file SbLineard.h.

◆ setValue() [1/2]

SbVec2d & SbVec2d::setValue ( const double  v[2])

◆ setValue() [2/2]

SbVec2d & SbVec2d::setValue ( double  x,
double  y 
)

Friends And Related Symbol Documentation

◆ operator!=

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

Definition at line 329 of file SbLineard.h.

◆ operator* [1/2]

INVENTOR_API SbVec2d operator* ( const SbVec2d v,
double  d 
)
friend

◆ operator* [2/2]

INVENTOR_API SbVec2d operator* ( double  d,
const SbVec2d v 
)
friend

Definition at line 320 of file SbLineard.h.

◆ operator+

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

◆ operator-

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

◆ operator/

INVENTOR_API SbVec2d operator/ ( const SbVec2d v,
double  d 
)
friend

Definition at line 322 of file SbLineard.h.

◆ operator==

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

Member Data Documentation

◆ vec

double SbVec2d::vec[2]
protected

Definition at line 316 of file SbLineard.h.


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