2D vector class. More...
#include <Inventor/SbVec.h>
Public Member Functions | |
SbVec2f () | |
SbVec2f (const float v[2]) | |
SbVec2f (float x, float y) | |
SbVec2f (float val) | |
float | dot (const SbVec2f &v) const |
const float * | getValue () const |
void | getValue (float &x, float &y) const |
float | length () const |
float | lengthSquared () const |
void | negate () |
float | normalize () |
SbVec2f & | setValue (const float v[2]) |
SbVec2f & | setValue (float x, float y) |
SbVec2f & | setValue (const SbVec2d &vec2d) |
SbVec2f & | operator*= (float d) |
SbVec2f | operator* (const SbVec2f &v) const |
SbVec2f & | operator*= (const SbVec2f &v) |
SbVec2f & | operator/= (float d) |
SbVec2f & | operator+= (const SbVec2f &u) |
SbVec2f & | operator-= (const SbVec2f &u) |
SbVec2f | operator- () const |
SbBool | equals (const SbVec2f &v, float tolerance) const |
template<typename T > | |
SbVec2f (const T &v) | |
Friends | |
SbVec2f | operator* (const SbVec2f &v, float d) |
SbVec2f | operator* (float d, const SbVec2f &v) |
SbVec2f | operator/ (const SbVec2f &v, float d) |
SbVec2f | operator+ (const SbVec2f &v1, const SbVec2f &v2) |
SbVec2f | operator- (const SbVec2f &v1, const SbVec2f &v2) |
int | operator== (const SbVec2f &v1, const SbVec2f &v2) |
int | operator!= (const SbVec2f &v1, const SbVec2f &v2) |
std::ostream & | operator<< (std::ostream &os, const SbVec2f &v) |
| |
float & | operator[] (int i) |
const float & | operator[] (int i) const |
2D vector class.
2D vector class used to store 2D vectors and points. This class is used throughout Open Inventor for arguments and return values.
SbRotation, SbRotationd, SbVec2d, SbVec2i32, SbVec2s, SbVec3d, SbVec3f, SbVec3i32, SbVec3s, SbVec4b, SbVec4d, SbVec4f, SbVec4i32, SbVec4s, SbVec4ub, SbVec4ui32, SbVec4us
SbVec2f::SbVec2f | ( | ) | [inline] |
Default constructor.
The vector initialized with zeros.
SbVec2f::SbVec2f | ( | const float | v[2] | ) | [inline, explicit] |
Constructor given vector components.
SbVec2f::SbVec2f | ( | float | x, | |
float | y | |||
) | [inline] |
Constructor given vector components.
SbVec2f::SbVec2f | ( | float | val | ) | [inline] |
Constructor that sets all components to the same value.
SbVec2f::SbVec2f | ( | const T & | v | ) | [inline, explicit] |
Constructor that converts an arbitrary SbVec2 to an SbVec2f.
float SbVec2f::dot | ( | const SbVec2f & | v | ) | const [inline] |
Returns dot (inner) product of vector and another vector.
Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.
void SbVec2f::getValue | ( | float & | x, | |
float & | y | |||
) | const |
Returns vector components.
const float* SbVec2f::getValue | ( | ) | const [inline] |
Returns vector components.
float SbVec2f::length | ( | ) | const |
Returns geometric length of vector.
float SbVec2f::lengthSquared | ( | ) | const [inline] |
Returns square length of vector.
Faster than length().
void SbVec2f::negate | ( | ) |
Negates each component of vector in place.
float SbVec2f::normalize | ( | ) |
Changes vector to be unit length.
Component-wise vector multiplication operator.
Component-wise vector multiplication operator.
SbVec2f& SbVec2f::operator*= | ( | float | d | ) |
Component-wise scalar multiplication operator.
SbVec2f SbVec2f::operator- | ( | ) | const |
Nondestructive unary negation - returns a new vector.
SbVec2f& SbVec2f::operator/= | ( | float | d | ) |
Component-wise scalar division operator.
const float& SbVec2f::operator[] | ( | int | i | ) | const [inline] |
Accesses indexed component of vector.
float& SbVec2f::operator[] | ( | int | i | ) | [inline] |
Accesses indexed component of vector.
Sets value of vector from a double precision vector.
If the values stored in the double precision argument(s) are too large to be stored in single precision variables, some loss of data will occur during the data transfer. The loss of data is defined by the standard C type conversion from double to float. It is the application's responsibility to handle this potential loss of data appropriately.
NOTE: Open Inventor fields still store only single precision values, not double precision values.
SbVec2f& SbVec2f::setValue | ( | float | x, | |
float | y | |||
) |
Sets the vector components.
SbVec2f& SbVec2f::setValue | ( | const float | v[2] | ) |
Sets the vector components.
Component-wise binary scalar multiplication operator.
Component-wise binary scalar multiplication operator.
Component-wise binary vector addition operator.
Component-wise binary vector subtraction operator.
Component-wise binary scalar division operator.
std::ostream& operator<< | ( | std::ostream & | os, | |
const SbVec2f & | v | |||
) | [friend] |
Writes the vector to the specified output stream.