Open Inventor Reference
SbVec2s Class Reference

2D vector class. More...

#include <Inventor/SbLinear.h>

Public Member Functions

 SbVec2s ()
 Default constructor. More...
 
 SbVec2s (const short v[2])
 Constructor given 2 components. More...
 
 SbVec2s (short x, short y)
 Constructor given 2 components. More...
 
int32_t dot (const SbVec2s &v) const
 Returns dot (inner) product of vector and another vector. More...
 
const short * getValue () const
 Returns vector components. More...
 
void getValue (short &x, short &y) const
 Returns vector components. More...
 
void negate ()
 Negates each component of vector in place. More...
 
SbVec2ssetValue (const short v[2])
 Sets vector components. More...
 
SbVec2ssetValue (short x, short y)
 Sets vector components. More...
 
short & operator[] (int i)
 Accesses indexed component of vector. More...
 
const short & operator[] (int i) const
 
SbVec2soperator*= (int d)
 Component-wise scalar multiplication and division operators. More...
 
SbVec2soperator*= (double d)
 Component-wise scalar multiplication and division operators. More...
 
SbVec2soperator/= (int d)
 Component-wise scalar multiplication and division operators. More...
 
SbVec2soperator/= (double d)
 Component-wise scalar multiplication and division operators. More...
 
SbVec2soperator+= (const SbVec2s &u)
 Component-wise vector addition and subtraction operators. More...
 
SbVec2soperator-= (const SbVec2s &u)
 Component-wise vector addition and subtraction operators. More...
 
SbVec2s operator- () const
 Nondestructive unary negation - returns a new vector. More...
 

Protected Attributes

short vec [2]
 Storage for vector components. More...
 

Friends

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

Detailed Description

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

See Also
SbVec3f, SbVec4f, SbVec2f

Definition at line 354 of file SbLinear.h.

Constructor & Destructor Documentation

◆ SbVec2s() [1/3]

SbVec2s::SbVec2s ( )
inline

Definition at line 358 of file SbLinear.h.

◆ SbVec2s() [2/3]

SbVec2s::SbVec2s ( const short  v[2])
inline

Definition at line 361 of file SbLinear.h.

◆ SbVec2s() [3/3]

SbVec2s::SbVec2s ( short  x,
short  y 
)
inline

Definition at line 364 of file SbLinear.h.

Member Function Documentation

◆ dot()

int32_t SbVec2s::dot ( const SbVec2s v) const

◆ getValue() [1/2]

const short* SbVec2s::getValue ( ) const
inline

Definition at line 370 of file SbLinear.h.

◆ getValue() [2/2]

void SbVec2s::getValue ( short &  x,
short &  y 
) const

◆ negate()

void SbVec2s::negate ( )

◆ operator*=() [1/2]

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

◆ operator*=() [2/2]

SbVec2s& SbVec2s::operator*= ( int  d)

◆ operator+=()

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

◆ operator-()

SbVec2s SbVec2s::operator- ( ) const

◆ operator-=()

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

◆ operator/=() [1/2]

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

Definition at line 396 of file SbLinear.h.

◆ operator/=() [2/2]

SbVec2s& SbVec2s::operator/= ( int  d)

◆ operator[]() [1/2]

short& SbVec2s::operator[] ( int  i)
inline

Definition at line 385 of file SbLinear.h.

◆ operator[]() [2/2]

const short& SbVec2s::operator[] ( int  i) const
inline

Definition at line 386 of file SbLinear.h.

◆ setValue() [1/2]

SbVec2s& SbVec2s::setValue ( const short  v[2])

◆ setValue() [2/2]

SbVec2s& SbVec2s::setValue ( short  x,
short  y 
)

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 442 of file SbLinear.h.

◆ operator* [1/4]

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

◆ operator* [2/4]

INVENTOR_API SbVec2s operator* ( const SbVec2s v,
int  d 
)
friend

◆ operator* [3/4]

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

Definition at line 432 of file SbLinear.h.

◆ operator* [4/4]

INVENTOR_API SbVec2s operator* ( int  d,
const SbVec2s v 
)
friend

Definition at line 430 of file SbLinear.h.

◆ operator+

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

◆ operator-

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

◆ operator/ [1/2]

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

Definition at line 435 of file SbLinear.h.

◆ operator/ [2/2]

INVENTOR_API SbVec2s operator/ ( const SbVec2s v,
int  d 
)
friend

◆ operator==

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

Member Data Documentation

◆ vec

short SbVec2s::vec[2]
protected

Definition at line 425 of file SbLinear.h.


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