Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SbVec2s Class Reference

2D vector class. More...

#include <Inventor/SbVec.h>

Public Member Functions

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

Friends

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

Detailed Description

2D vector class.

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

SEE ALSO

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

Definition at line 700 of file SbVec.h.

Constructor & Destructor Documentation

◆ SbVec2s() [1/5]

SbVec2s::SbVec2s ( )
inline

Default constructor.

The vector is initialized with zeros.

Definition at line 706 of file SbVec.h.

◆ SbVec2s() [2/5]

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

Constructor given 2 components.

Definition at line 711 of file SbVec.h.

◆ SbVec2s() [3/5]

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

Constructor given 2 components.

Definition at line 716 of file SbVec.h.

◆ SbVec2s() [4/5]

SbVec2s::SbVec2s ( const SbVec2i32 v)
explicit

Constructor given an SbVec2i32.

◆ SbVec2s() [5/5]

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

Constructor that converts an arbitrary SbVec2 to an SbVec2s.

Definition at line 861 of file SbVec.h.

Member Function Documentation

◆ dot()

int32_t SbVec2s::dot ( const SbVec2s v) const
inline

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

Definition at line 728 of file SbVec.h.

◆ getValue() [1/2]

const short * SbVec2s::getValue ( ) const
inline

Returns vector components.

Definition at line 734 of file SbVec.h.

◆ getValue() [2/2]

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

Returns vector components.

◆ negate()

void SbVec2s::negate ( )

Negates each component of vector in place.

◆ operator*=() [1/2]

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

Component-wise scalar multiplication operator.

◆ operator*=() [2/2]

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

Component-wise scalar multiplication operator.

◆ operator+=()

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

Component-wise vector addition operator.

◆ operator-()

SbVec2s SbVec2s::operator- ( ) const

Nondestructive unary negation - returns a new vector.

◆ operator-=()

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

Component-wise vector subtraction operator.

◆ operator/=() [1/2]

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

Component-wise scalar division operator.

Definition at line 780 of file SbVec.h.

◆ operator/=() [2/2]

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

Component-wise scalar division operator.

◆ operator=()

SbVec2s SbVec2s::operator= ( const SbVec2i32 v)

Component-wise set operator.

◆ operator[]() [1/2]

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

Accesses indexed component of vector.

Definition at line 760 of file SbVec.h.

◆ operator[]() [2/2]

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

Definition at line 761 of file SbVec.h.

◆ setValue() [1/2]

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

Sets vector components.

◆ setValue() [2/2]

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

Sets vector components.

Friends And Related Symbol Documentation

◆ operator!=

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

Inequality comparison operator.

Definition at line 849 of file SbVec.h.

◆ operator* [1/4]

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

Component-wise binary scalar multiplication operator.

◆ operator* [2/4]

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

Component-wise binary scalar multiplication operator.

◆ operator* [3/4]

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

Component-wise binary scalar multiplication operator.

Definition at line 820 of file SbVec.h.

◆ operator* [4/4]

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

Component-wise binary scalar multiplication operator.

Definition at line 815 of file SbVec.h.

◆ operator+

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

Component-wise binary vector addition operator.

◆ operator-

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

Component-wise binary vector subtraction operator.

◆ operator/ [1/2]

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

Component-wise binary scalar division operator.

Definition at line 829 of file SbVec.h.

◆ operator/ [2/2]

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

Component-wise binary scalar division operator.

◆ operator<<

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

Writes the vector to the specified output stream.

Definition at line 3596 of file SbVec.h.

◆ operator==

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

Equality comparison operator.


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