SBVEC2F(3iv)
๐ SbVec2f โ the 2D vector class (from the 3IV manual, bestie)
okay so picture this: you need to store a 2D vector. a point. a lil (x, y) situation. that's SbVec2f, and she is the moment. she's used all over Inventor for arguments and return values, which honestly makes her the main character of linear algebra in this library. periodt. ๐
๐ธ INHERITS FROM
SbVec2f โ yeah she inherits from herself, iconic behaviour honestly, no notes โจ
๐ SYNOPSIS
first, the incantation to even get her in the room:
#include <Inventor/SbLinear.h>
then, all her methods, verbatim, in all their glory:
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 โจ
so. SbVec2f is the 2D vector class that holds your 2D vectors and points. that's it, that's her whole job, and she does it flawlessly. ๐ฆ
she's used throughout Inventor for arguments and return values, so like, you WILL be seeing her again. she's everywhere. she's the vibe.
๐ METHODS ๐
the constructors ๐ผ
SbVec2f()โ the default constructor. no args, no drama, just an empty lil vector waiting to be something. ๐SbVec2f(const float v[2])SbVec2f(float x, float y)โ constructor given vector components. hand her your numbers (either afloatarray of 2, orxandyseparately) and she's ready. slay. โจ
the maths girlies ๐งฎ
float dot(const SbVec2f &v) constโ returns the dot (inner) product of your vector and another vector. it's giving "multiply and add, bestie."SbBool equals(const SbVec2f v, float tolerance) constโ equality comparison within a given tolerance โ and heads up, the tolerance is the square of the length of the maximum distance between the two vectors. yes, the SQUARE. not the distance itself. don't get caught out. ๐ญfloat length() constโ returns the geometric length of the vector. how long is she? very. ๐void negate()โ negates each component of the vector, in place. she flips herself, no new object, no waste. sustainable queen. ๐ธfloat normalize()โ changes the vector to be unit length. she shrinks down to size 1 and stays that way. ๐
getting and setting ๐
const float * getValue() constvoid getValue(float &x, float &y) constโ returns vector components. either you get the pointer, or you getxandyhanded to you by reference. both valid, both cute. ๐SbVec2f & setValue(const float v[2])SbVec2f & setValue(float x, float y)โ sets the vector components. feed her the array, or feed her the two floats. she returns herself back so you can chain, which is highkey thoughtful of her. ๐ซถfloat & operator [](int i)const float & operator [](int i)โ accesses the indexed component of the vector. yes, there's a const version, because she respects const-correctness. โญ
the operator section, aka where she really ate ๐ฅ
SbVec2f & operator *=(float d)SbVec2f & operator /=(float d)โ component-wise scalar multiplication and division operators. one scalar, applied to everything, in place.SbVec2f & operator +=(const SbVec2f &u)SbVec2f & operator -=(const SbVec2f &u)โ component-wise vector addition and subtraction operators. also in place. also returning a reference to herself. also iconic.SbVec2f operator -() constโ nondestructive unary negation โ returns a new vector. she does NOT touch the original. that's the whole point. do not confuse her withnegate(). ๐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. note there's a version with the scalar on the left AND one with it on the right, because she plays both sides. generous. โจ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. they hand you back anint, and you just accept that. ๐
๐ SEE ALSO
if you liked her, you'll love her friends:
SbVec3fSbVec4fSbVec2sSbRotation
ngl bestie, if you remember nothing else, remember:negate()mutates, unaryoperator -()doesn't, and theequalstolerance is the SQUARE of that max distance. that's the whole vibe check. ๐ง
and that's the page!! this was SbVec2f(3IV), from the 3IV manual, dated and versioned exactly as she always was โ no cap, same source, same date, just delivered with a little more ๐ than usual. mwah. ๐๐
๐ฆ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 ยท LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 ยท LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 ยท LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 ยท LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 ยท LGPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms