Scroll to navigation

SbVec2f(3IV)() SbVec2f(3IV)()

NAME

SbVec2f — 2D vector class

INHERITS FROM

SbVec2f

SYNOPSIS

#include <Inventor/SbLinear.h>


Methods from class SbVec2f:


SbVec2f()

SbVec2f(const float v[2])

SbVec2f(float x, float y)

float dot(const SbVec2f &v) const

SbBool equals(const SbVec2f v, float tolerance) const

const float * getValue() const

void getValue(float &x, float &y) const

float length() const

void negate()

float normalize()

SbVec2f & setValue(const float v[2])

SbVec2f & setValue(float x, float y)

float & operator [](int i)

const float & operator [](int i)

SbVec2f & operator *=(float d)

SbVec2f & operator /=(float d)

SbVec2f & operator +=(const SbVec2f &u)

SbVec2f & operator -=(const SbVec2f &u)

SbVec2f operator -() const

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)

DESCRIPTION

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

METHODS


SbVec2f()

Default constructor.



SbVec2f(const float v[2])

SbVec2f(float x, float y)

Constructor given vector components.



float dot(const SbVec2f &v) const

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



SbBool equals(const SbVec2f v, float tolerance) const

Equality comparison within given tolerance — the square of the length of the maximum distance between the two vectors.



const float * getValue() const

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.



SbVec2f & setValue(const float v[2])

SbVec2f & setValue(float x, float y)

Sets the vector components.



float & operator [](int i)

const float & operator [](int i)

Accesses indexed component of vector.



SbVec2f & operator *=(float d)

SbVec2f & operator /=(float d)

Component-wise scalar multiplication and division operators.



SbVec2f & operator +=(const SbVec2f &u)

SbVec2f & operator -=(const SbVec2f &u)

Component-wise vector addition and subtraction operators.



SbVec2f operator -() const

Nondestructive unary negation — returns a new vector.



SbVec2f operator *(const SbVec2f &v, float d)

SbVec2f operator *(float d, const SbVec2f &v)

SbVec2f operator /(const SbVec2f &v, float d)

Component-wise binary scalar multiplication and division operators.



SbVec2f operator +(const SbVec2f &v1, const SbVec2f &v2)

SbVec2f operator -(const SbVec2f &v1, const SbVec2f &v2)

Component-wise binary vector addition and subtraction operators.



int operator ==(const SbVec2f &v1, const SbVec2f &v2)

int operator !=(const SbVec2f &v1, const SbVec2f &v2)

Equality comparison operators.


SEE ALSO

SbVec3f, SbVec4f, SbVec2s, SbRotation