SbVec3f(3)
π SbVec3f π
okay bestie, welcome to SbVec3f(3) from the Library Functions Manual β yes that's the manual name, we're not being formal about it, we're just gonna vibe π
This is the class that gives you a 3 dimensional vector with floating point coordinates. She's the blueprint, she's the blueprint, periodt β¨
πΈ NAME πΈ
SbVec3f</pη΄«θ²> β the SbVec3f class is a 3 dimensional vector with floating point coordinates. That's it, that's the whole job description, and she does it flawlessly π«Ά
π SYNOPSIS π
#include <Inventor/SbLinear.h>
Inherited by SbColor. (yes she has offspring, we love a legacy moment π)
β¨ Public Member Functions β¨
SbVec3f(void)SbVec3f(const float v[3])SbVec3f(float x, float y, float z)SbVec3f(const SbVec3d &v)SbVec3f(const SbVec3b &v)SbVec3f(const SbVec3s &v)SbVec3f(const SbVec3i32 &v)SbVec3f(const SbPlane &p0, const SbPlane &p1, const SbPlane &p2)SbVec3f & setValue(const float v[3])SbVec3f & setValue(float x, float y, float z)SbVec3f & setValue(const SbVec3f &barycentric, const SbVec3f &v0, const SbVec3f &v1, const SbVec3f &v2)SbVec3f & setValue(const SbVec3d &v)SbVec3f & setValue(const SbVec3b &v)SbVec3f & setValue(const SbVec3s &v)SbVec3f & setValue(const SbVec3i32 &v)const float * getValue(void) constvoid getValue(float &x, float &y, float &z) constfloat & operator[](int i)const float & operator[](int i) constSbBool equals(const SbVec3f &v, float tolerance) constSbVec3f cross(const SbVec3f &v) constfloat dot(const SbVec3f &v) constSbVec3f getClosestAxis(void) constfloat length(void) constfloat sqrLength(void) constfloat normalize(void)void negate(void)SbVec3f & operator*=(float d)SbVec3f & operator/=(float d)SbVec3f & operator+=(const SbVec3f &v)SbVec3f & operator-=(const SbVec3f &v)SbVec3f operator-(void) constvoid print(FILE *fp) const
π Protected Attributes π
float vec[3]
π¦ Related Symbols π¦
(note that these are not member symbols, they're the outside-the-house besties)
SbVec3f operator*(const SbVec3f &v, float d)SbVec3f operator*(float d, const SbVec3f &v)SbVec3f operator/(const SbVec3f &v, float d)SbVec3f operator+(const SbVec3f &v1, const SbVec3f &v2)SbVec3f operator-(const SbVec3f &v1, const SbVec3f &v2)int operator==(const SbVec3f &v1, const SbVec3f &v2)int operator!=(const SbVec3f &v1, const SbVec3f &v2)
π Detailed Description π
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
This vector class is used by so many other classes in Coin, like she's the popular girl fr fr π . She provides storage for a 3 dimensional vector aswell as simple floating point arithmetic operations. Lowkey the backbone of everything, no cap.
See also
SbVec2s,SbVec2f,SbVec2d,SbVec3s,SbVec3d,SbVec4f,SbVec4d.
π§ Constructor & Destructor Documentation π§
SbVec3f::SbVec3f(void) [inline]
The default constructor does nothing. π The vector coordinates will be uninitialized until you do a setValue() call. So likeβ¦ she's born but she doesn't know who she is yet. Character development pending. Do not read her before you set her, bestie, that's giving undefined behaviour energy π
SbVec3f::SbVec3f(const float v[3]) [inline]
Constructs an SbVec3f instance with initial values from v. Slay, she comes pre-loaded β¨
SbVec3f::SbVec3f(float x, float y, float z) [inline]
Constructs an SbVec3f instance with the initial vector endpoint set to <x,y,z>. Iconic trio, love that for her π
SbVec3f::SbVec3f(const SbVec3d & v) [inline], [explicit]
Constructs an SbVec3f instance from an SbVec3d instance. Glow-down from double to single precision, we respect the transition π¦
SbVec3f::SbVec3f(const SbVec3b & v) [inline], [explicit]
Constructs an SbVec3f instance from an SbVec3b instance.
Since
- Coin 2.5
SbVec3f::SbVec3f(const SbVec3s & v) [inline], [explicit]
Constructs an SbVec3f instance from an SbVec3s instance.
Since
- Coin 2.5
SbVec3f::SbVec3f(const SbVec3i32 & v) [inline], [explicit]
Constructs an SbVec3f instance from an SbVec3i32 instance.
Since
- Coin 2.5
SbVec3f::SbVec3f(const SbPlane & p0, const SbPlane & p1, const SbPlane & p2)
Constructs an SbVec3f instance by combining the three given planes. None of the planes should be parallel to any of the other two, otherwise a divide by zero error will occur. π¨ Bestie. Do NOT. The math will simply not math. π
π Member Function Documentation π
SbVec3f & SbVec3f::setValue(const float v[3]) [inline]
Set new coordinates for the vector from v. Returns reference to self. (She returns herself. Main character energy π)
See also
getValue().
SbVec3f & SbVec3f::setValue(float x, float y, float z) [inline]
Set new coordinates for the vector. Returns reference to self.
See also
getValue().
SbVec3f & SbVec3f::setValue(const SbVec3f & barycentric, const SbVec3f & v0, const SbVec3f & v1, const SbVec3f & v2)
Set this vector to be the average of v0, v1 and v2. The vector components are weighted by the barycentric vector. Math girlie behaviour and we're obsessed β¨
See also
getValue().
SbVec3f & SbVec3f::setValue(const SbVec3d & v)
Sets this vector to the double precision vector v, converting the vector to a single precision vector.
This is a Coin extension.
Since
- Coin 2.0
SbVec3f & SbVec3f::setValue(const SbVec3b & v)
Since
- Coin 2.5
See also
getValue()
SbVec3f & SbVec3f::setValue(const SbVec3s & v)
Since
- Coin 2.5
See also
getValue()
SbVec3f & SbVec3f::setValue(const SbVec3i32 & v)
Since
- Coin 2.5
See also
getValue()
const float * SbVec3f::getValue(void) const [inline]
Returns a pointer to an array of three floats containing the x, y and z coordinates of the vector. Here's your girl's whole personality in one pointer π«Ά
See also
setValue().
void SbVec3f::getValue(float & x, float & y, float & z) const [inline]
Returns the x, y and z coordinates of the vector. Yes the same info, different delivery format, both valid, both iconic.
See also
setValue().
float & SbVec3f::operator[](int i) [inline]
Index operator. Returns modifiable x, y or z coordinate of vector. (Modifiable! You can change her! With consent! π )
See also
getValue()andsetValue().
const float & SbVec3f::operator[](int i) const [inline]
Index operator. Returns x, y or z coordinate of vector. Read-only edition, no touching π
See also
getValue()andsetValue().
SbBool SbVec3f::equals(const SbVec3f & v, float tolerance) const
Compares the vector with v and returns TRUE if the distance between the vectors is smaller or equal to the square root of tolerance. Note: the square root of tolerance, bestie, not tolerance itself. Read it twice, it's not a typo π
SbVec3f SbVec3f::cross(const SbVec3f & v) const
Returns the result of taking the cross product of this vector and v. Perpendicular queen π
float SbVec3f::dot(const SbVec3f & v) const [inline]
Calculates and returns the result of taking the dot product of this vector and v.
SbVec3f SbVec3f::getClosestAxis(void) const
Return the vector representing the principal axis closest to this vector. She's finding her nearest axis bestie, we all need that π§
float SbVec3f::length(void) const
Return length of vector.
float SbVec3f::sqrLength(void) const [inline]
Returns the squared length of the vector. (Cheaper than the square root, lowkey the efficient one β¨)
float SbVec3f::normalize(void)
Normalize the vector to unit length. Return value is the original length of the vector before normalization. So she tells you how far she came from, cute.
If the vector is the null vector, no attempt at normalization will be done. If the Coin library was built in a debug version, and the COIN_DEBUG_NORMALIZE environment variable is set, this error message will then be shown:
Coin warning in SbVec3f::normalize(): The length of the vector
should be > 0.0f to be able to normalize.
We've made it possible for Coin to spit out a warning when an attempt at normalizing a null-vector is made, as that seems to sometimes be a symptom caused by some graver error somewhere else -- either an internal error in Coin code, a programming error in application code, or an error in an input file (like for instance invalid polygon specifications).
If you run into bugs/problems with your application or with Coin, it could be a good idea to set COIN_DEBUG_NORMALIZE=1, and then restart the application to see if you get any warnings from normalize(). Detective mode activated π
If this happens, you should run the application in a debugger and see how the call-stack backtrace looks when it hits. An easy way of getting a debugger break at the warning spot is to set the following debugging environment variable which will make the code assert:
COIN_DEBUG_BREAK="SbVec3f::normalize"
If you from the backtrace analysis strongly suspects an internal Coin bug, please report the call-stack to us at coin-support@coin3d.org and we'll look into it. Example code that triggers the bug would then also be very helpful. (They're so nice about it, fr fr π«Ά)
A note for developers porting code from SGI or TGS Inventor to Coin: those Inventor implementations are more slack about detecting and giving out warning messages upon API misuses, and you may suddenly have gotten this warning with Coin without seeing any indication of an error with SGI/TGS Inventor. This does not necessarily mean that it is a bug in Coin -- it is much more likely that you are getting a warning as an indication of API misuse or import file errors which were just not detected and/or reported with those Inventor implementations. π
void SbVec3f::negate(void) [inline]
Negate the vector (i.e. point it in the opposite direction). Full 180, she turned around and left π
SbVec3f & SbVec3f::operator*=(float d) [inline]
Multiply components of vector with scalar value d. Returns reference to self.
SbVec3f & SbVec3f::operator/=(float d) [inline]
Divides components of vector with scalar value d. Returns reference to self.
SbVec3f & SbVec3f::operator+=(const SbVec3f & u) [inline]
Adds this vector and vector u. Returns reference to self.
SbVec3f & SbVec3f::operator-=(const SbVec3f & u) [inline]
Subtracts vector u from this vector. Returns reference to self.
SbVec3f SbVec3f::operator-(void) const [inline]
Non-destructive negation operator. Returns a new SbVec3f instance which points in the opposite direction of this vector. She copies herself, flips, and hands you the new one. No damage done, we love a gentle queen π
See also
negate().
void SbVec3f::print(FILE * fp) const
Dump the state of this object to the file stream. Only works in debug version of library, method does nothing in an optimized compile. She only speaks when the debug build is on, otherwise she's silent π
π₯ Friends And Related Symbol Documentation π₯
SbVec3f operator*(const SbVec3f & v, float d) [related]
Returns an SbVec3f instance which is the components of vector v multiplied with d.
SbVec3f operator*(float d, const SbVec3f & v) [related]
Returns an SbVec3f instance which is the components of vector v multiplied with d. (Same as above, just d standing on the other side. Order doesn't matter here, she's flexible like that π
)
SbVec3f operator/(const SbVec3f & v, float d) [related]
Returns an SbVec3f instance which is the components of vector v divided on the scalar factor d.
SbVec3f operator+(const SbVec3f & v1, const SbVec3f & v2) [related]
Returns an SbVec3f instance which is the sum of vectors v1 and v2.
SbVec3f operator-(const SbVec3f & v1, const SbVec3f & v2) [related]
Returns an SbVec3f instance which is vector v2 subtracted from vector v1. Watch the direction, bestie, v2 comes OFF v1 π
int operator==(const SbVec3f & v1, const SbVec3f & v2) [related]
Returns 1 if v1 and v2 are exactly equal, 0 otherwise. Exactly, like no tolerance whatsoever, she's strict π
See also
equals().
int operator!=(const SbVec3f & v1, const SbVec3f & v2) [related]
Returns 1 if v1 and v2 are not equal, 0 if they are equal.
See also
equals().
π Author π
Generated automatically by Doxygen for Coin from the source code. (Not a human author, just Doxygen doing its little thing, and honestly? Slay, bestie π€π)
and that's the whole page, you made it to the end, I'm so proud of you π₯Ήπ
This was SbVec3f(3) from Coin, Version 3.1.3 β that's the source and version and the date stamp of this little love letter, mwah π go forth and vector responsibly, bestie β¨ππ¦
π¦ where this page comes from
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms