SbVec3f(3)
β¨ SbVec3f(3) β Library Functions Manual β¨
π NAME π
SbVec3f β the 3 dimensional vector class with floating point coordinates. It's giving math but make it fashion, bestie. π
π¦ SYNOPSIS π¦
#include <Inventor/SbLinear.h>
Inherited by SbColor.
π Public Member Functions π
SbVec3f (void)SbVec3f (const float v[3])SbVec3f (const float x, const float y, const float z)SbVec3f (const SbPlane &p0, const SbPlane &p1, const SbPlane &p2)SbVec3f (const SbVec3d &v)SbVec3f (const SbVec3b &v)SbVec3f (const SbVec3s &v)SbVec3f (const SbVec3i32 &v)SbVec3f & setValue (const float v[3])SbVec3f & setValue (const float x, const float y, const 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)SbVec3f cross (const SbVec3f &v) constfloat dot (const SbVec3f &v) constSbBool equals (const SbVec3f &v, const float tolerance) constSbVec3f getClosestAxis (void) constconst float * getValue (void) constvoid getValue (float &x, float &y, float &z) constfloat length (void) constfloat sqrLength () constvoid negate (void)float normalize (void)float & operator[] (const int i)const float & operator[] (const int i) constSbVec3f & operator*= (const float d)SbVec3f & operator/= (const float d)SbVec3f & operator+= (const SbVec3f &u)SbVec3f & operator-= (const SbVec3f &u)SbVec3f operator- (void) constvoid print (FILE *fp) const
π«Ά Friends π«Ά
SbVec3f operator* (const SbVec3f &v, const float d)SbVec3f operator* (const float d, const SbVec3f &v)SbVec3f operator/ (const SbVec3f &v, const 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 many other classes in Coin. It provides storage for a 3 dimensional vector aswell as simple floating point arithmetic operations. (Yes, the original says βaswellβ β we donβt make the rules, we just keep the details, periodt. π )
See also: SbVec2f, SbVec2d, 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, donβt touch it until you set it, bestie. π«
Referenced by cross(), dot(), equals(), getClosestAxis(), operator!=, operator*, operator*, operator+, operator+=(), operator-, operator-(), operator-=(), operator/, operator==, SbColor::SbColor(), SbColor::SbColor(), SbColor::SbColor(), SbColor::SbColor(), SbVec3f(), and setValue().
SbVec3f::SbVec3f (const float v[3])
Constructs an SbVec3f instance with initial values from v.
SbVec3f::SbVec3f (const float x, const float y, const float z)
Constructs an SbVec3f instance with the initial vector endpoint set to <x,y,z>.
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. So like, keep them non-parallel or itβs giving crash era. π
References dot(), SbPlane::getDistanceFromOrigin(), SbPlane::getNormal(), SoDebugError::postWarning(), and SbVec3f().
SbVec3f::SbVec3f (const SbVec3d & v)
Constructs an SbVec3f instance with initial values from the double precision vector v.
This is a Coin extension.
DEPRECATED for Coin 3.0 -- don't use this.
Since: Coin 2.0
References setValue().
SbVec3f::SbVec3f (const SbVec3b & v) [inline], [explicit]
Constructs an SbVec3d instance with initial values from the 8-bit integer precision vector v. (Yes, it says SbVec3d in the original β weβre not fixing typos, weβre preserving history. π)
References setValue().
SbVec3f::SbVec3f (const SbVec3s & v) [inline], [explicit]
Constructs an SbVec3f instance with initial values from the short integer precision vector v.
References setValue().
SbVec3f::SbVec3f (const SbVec3i32 & v) [inline], [explicit]
Constructs an SbVec3d instance with initial values from the 32-bit integer precision vector v. (Another SbVec3d mention β iconic typo energy, we stan. β¨)
References setValue().
More parts coming, bestie β donβt go anywhere! π
π Member Function Documentation π
okay bestie, deep breath β this is the big one, every single member function, all of it. no skimming, we're eating the whole plate π
β¨ SbVec3f & SbVec3f::setValue (const float v[3])
Sets fresh new coordinates for the vector, lifted straight out of v. Hands you back a reference to itself. slay.
- See also:
getValue(). - Referenced by:
SoCone::computeBBox(),SoCube::computeBBox(),SoCylinder::computeBBox(),SoIndexedNurbsCurve::computeBBox(),SoIndexedShape::computeBBox(),SoSphere::computeBBox(),SoVRMLBox::computeBBox(),SoVRMLCone::computeBBox(),SoVRMLCylinder::computeBBox(),SoVRMLSphere::computeBBox(),SoNonIndexedShape::computeCoordBBox(),SoTrackballDragger::dragStart(),SbXfBox3f::extendBy(),SbXfBox3f::extendBy(),SoGetBoundingBoxAction::getCenter(),SoShape::getScreenSize(),SbBox3f::getSpan(),SbBox3i32::getSpan(),SbRotation::getValue(),SoRayPickAction::intersect(),SoRayPickAction::intersect(),SoRayPickAction::intersect(),SoCamera::pointAt(),SoTabPlaneDragger::reallyAdjustScaleTabSize(),SbVec3f(),SbVec3f(),SbVec3f(),SbVec3f(),SbColor::setHSVValue(),SbColor::setPackedValue(),SbBox3f::transform(), andSbBox3i32::transform().
β¨ SbVec3f & SbVec3f::setValue (const float x, const float y, const float z)
Sets new coordinates for the vector. Returns a reference to itself. β¨
- See also:
getValue().
β¨ SbVec3f & SbVec3f::setValue (const SbVec3f & barycentric, const SbVec3f & v0, const SbVec3f & v1, const SbVec3f & v2)
Sets this vector to be the average of v0, v1 and v2. The vector components get weighted by the barycentric vector. it's giving math but make it fashion π
- See also:
getValue(). - References:
SbVec3f().
β¨ SbVec3f & SbVec3f::setValue (const SbVec3d & v)
Sets this vector to the double precision vector v, converting it down to a single precision vector.
This is a Coin extension.
- Since: Coin 2.0
- References:
SoDebugError::postWarning().
β¨ SbVec3f & SbVec3f::setValue (const SbVec3b & v)
Sets new coordinates for the vector from v. Returns a reference to itself.
- See also:
getValue(). - Since: Coin-2.5
- See also:
getValue()
β¨ SbVec3f & SbVec3f::setValue (const SbVec3s & v)
Sets new coordinates for the vector from v. Returns a reference to itself.
- See also:
getValue(). - Since: Coin-2.5
- See also:
getValue()
β¨ SbVec3f & SbVec3f::setValue (const SbVec3i32 & v)
Sets new coordinates for the vector from v. Returns a reference to itself.
- See also:
getValue(). - Since: Coin-2.5
- See also:
getValue()
π SbVec3f SbVec3f::cross (const SbVec3f & v) const
okay so heads up bestie, the doc text for this one has a bunch of constructor stuff spliced into it π β not me doing that, it's literally how it's printed. keeping every single line because nothing gets dropped in this house:
SbVec3f::SbVec3f(const SbVec3b & v)
Constructs an SbVec3f instance with initial values from the vector v.
- Since: Coin-2.5
SbVec3f::SbVec3f(const SbVec3s & v)
Constructs an SbVec3f instance with initial values from the vector v.
- Since: Coin-2.5
SbVec3f::SbVec3f(const SbVec3i32 & v)
Constructs an SbVec3f instance with initial values from the vector v.
- Since: Coin-2.5
Returns the result of taking the cross product of this vector and v. π¦
- References:
SbVec3f(). - Referenced by:
SoRotateDiscDragger::drag(),SbSpherePlaneProjector::getRotation(),SoCamera::GLRender(),SbCylinder::intersect(),SbPlane::intersect(), andSbRotation::setValue().
πΈ float SbVec3f::dot (const SbVec3f & v) const
Calculates and returns the result of taking the dot product of this vector and v. math girlies stay winning π₯
- References:
SbVec3f(). - Referenced by:
SbClip::clip(),SoRotateDiscDragger::drag(),SoScale2UniformDragger::drag(),SoScaleUniformDragger::drag(),SoSpotLightDragger::drag(),SoTabPlaneDragger::drag(),SoTrackballDragger::drag(),SbPlane::getDistance(),SbCylinderPlaneProjector::getRotation(),SbCylinderSectionProjector::getRotation(),SbCylinderSheetProjector::getRotation(),SbSpherePlaneProjector::getRotation(),SbBox3f::getSpan(),SbBox3i32::getSpan(),SbCylinder::intersect(),SbSphere::intersect(),SbCylinderProjector::isPointInFront(),SbSphereProjector::isPointInFront(),SoCamera::pointAt(),SbVec3f(),SbRotation::setValue(), andSoFrustumCamera::viewBoundingBox().
π SbBool SbVec3f::equals (const SbVec3f & v, const 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. ngl that's the whole vibe check β
- References:
SoDebugError::postWarning(), andSbVec3f().
π SbVec3f SbVec3f::getClosestAxis (void ) const
Returns the vector representing the principal axis closest to this vector. main character axis energy fr fr.
- References:
SbVec3f().
β const float * SbVec3f::getValue (void ) const
Returns a pointer to an array of three floats containing the x, y and z coordinates of the vector.
- See also:
setValue(). - Referenced by:
SoCamera::audioRender(),SoListener::audioRender(),SoVRMLSound::audioRender(),SoSpotLightDragger::drag(),SoSpotLightDragger::dragStart(),SoVRMLGroup::getBoundingBox(),SoVRMLInline::getBoundingBox(),SbBox3f::getOrigin(),SoVRMLElevationGrid::GLRender(),SoVRMLInline::GLRender(),SoShape::invokeLineSegmentCallbacks(),SoShape::invokePointCallbacks(),SoShape::invokeTriangleCallbacks(),SoCamera::jitter(), andSoTransformManip::valueChangedCB().
β void SbVec3f::getValue (float & x, float & y, float & z) const
Returns the x, y and z coordinates of the vector. (yes, same name, different signature β overloads are iconic like that π )
- See also:
setValue().
π float SbVec3f::length (void ) const
Returns the length of the vector. β¨
- Referenced by:
SoVRMLSound::audioRender(),SoScale2UniformDragger::drag(),SoScaleUniformDragger::drag(),SoSpotLightDragger::drag(),SoTabPlaneDragger::drag(),SoTrackballDragger::drag(),SoRotateSphericalDragger::dragStart(),SoTrackballDragger::dragStart(),SoTransformerDragger::dragStart(),SoVRMLSphereSensor::dragStart(),SbBSPTree::findClosest(),SbLine::getClosestPoint(),SbLine::getClosestPoints(),SbSpherePlaneProjector::getRotation(),SbCylinder::intersect(),SbSphere::intersect(),normalize(),SbRotation::SbRotation(),SbCylinder::setAxis(),SbRotation::setValue(), andSbRotation::setValue().
π float SbVec3f::sqrLength (void ) const
Returns the squared length of the vector. no square root, we keep it simple bestie π«Ά
- Referenced by:
SbPlane::intersect(),SbPlane::SbPlane(), andSbPlane::SbPlane().
π¦ void SbVec3f::negate (void )
Negates the vector β i.e. points it in the exact opposite direction. turn around, flip the vibe π
- Referenced by:
SbSphereSheetProjector::project().
π
float SbVec3f::normalize (void )
Normalizes the vector to unit length. The return value is the original length of the vector, from before the normalization happened.
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.
They made it possible for Coin to spit out a warning when an attempt at normalizing a null-vector is made, because 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 setCOIN_DEBUG_NORMALIZE=1, and then restart the application to see if you get any warnings fromnormalize().
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 suspect an internal Coin bug, please report the call-stack to them at coin-support@coin3d.org and they'll look into it. Example code that triggers the bug would then also be very helpful. π
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.
- References:
length(),operator/=(), andSoDebugError::postWarning(). - Referenced by:
SoVRMLSound::audioRender(),SbClip::clip(),SoRotateDiscDragger::drag(),SoTrackballDragger::drag(),SoTrackballDragger::dragStart(),SoImage::generatePrimitives(),SbLine::getClosestPoints(),SbSpherePlaneProjector::getRotation(),SbBox3f::getSpan(),SbBox3i32::getSpan(),SoCamera::GLRender(),SoDirectionalLight::GLRender(),SoVRMLDirectionalLight::GLRender(),SbCylinder::intersect(),SbSphere::intersect(),SoShape::invokeLineSegmentCallbacks(),SoShape::invokeTriangleCallbacks(),SoCamera::pointAt(),SoCamera::pointAt(),SoTransform::pointAt(),SoVRMLTransform::pointAt(),SbPlane::SbPlane(),SbPlane::SbPlane(),SbLine::setValue(),SbRotation::setValue(),SbRotation::setValue(),SoFrustumCamera::viewBoundingBox(),SoOrthographicCamera::viewBoundingBox(), andSoPerspectiveCamera::viewBoundingBox().
π float & SbVec3f::operator[] (const int i) [inline]
Index operator. Returns a modifiable x, y or z coordinate of the vector. yes you can write to it, go off π
- See also:
getValue()andsetValue().
π const float & SbVec3f::operator[] (const int i) const [inline]
Index operator. Returns an x, y or z coordinate of the vector. (read-only edition, no touching π)
- See also:
getValue()andsetValue().
β¨ SbVec3f & SbVec3f::operator*= (const float d)
Multiplies the components of the vector with the scalar value d. Returns a reference to itself.
β¨ SbVec3f & SbVec3f::operator/= (const float d)
Divides the components of the vector with the scalar value d. Returns a reference to itself.
- References:
SoDebugError::postWarning(). - Referenced by:
normalize().
β¨ SbVec3f & SbVec3f::operator+= (const SbVec3f & u)
Adds this vector and the vector u. Returns a reference to itself.
- References:
SbVec3f().
β¨ SbVec3f & SbVec3f::operator-= (const SbVec3f & u)
Subtracts the vector u from this vector. Returns a reference to itself.
- References:
SbVec3f().
π SbVec3f SbVec3f::operator- (void ) const
Non-destructive negation operator. Returns a new SbVec3f instance which points in the opposite direction of this vector. your original stays untouched, we love a respectful king π
- See also:
negate(). - References:
SbVec3f().
π void SbVec3f::print (FILE * fp) const
Dumps the state of this object to the file stream. Only works in a debug version of the library β in an optimized compile this method does nothing at all. π
- Referenced by:
SbBox3f::print(),SbLine::print(),SbPlane::print(),SbSphere::print(),SbViewVolume::print(), andSbXfBox3f::print().
Friends And Related Symbol Documentation π«Ά
Okay bestie, this is the friend-zone section β but make it fashion. These are the non-member operator functions that still get VIP access to SbVec3f's business. They all return fresh SbVec3f instances and do exactly what the tin says. No cap. π
π SbVec3f operator* (const SbVec3f & v, const float d) [friend]
Returns an SbVec3f instance which is the components of vector v multiplied with d.
References: SbVec3f().
π SbVec3f operator* (const float d, const SbVec3f & v) [friend]
Returns an SbVec3f instance which is the components of vector v multiplied with d.
References: SbVec3f().
π SbVec3f operator/ (const SbVec3f & v, const float d) [friend]
Returns an SbVec3f instance which is the components of vector v divided on the scalar factor d.
References: SoDebugError::postWarning(), and SbVec3f().
π«Ά Okay so the references include SoDebugError::postWarning() β that's literally what the page says, bestie. Keep it in the notes. β¨
π SbVec3f operator+ (const SbVec3f & v1, const SbVec3f & v2) [friend]
Returns an SbVec3f instance which is the sum of vectors v1 and v2.
References: SbVec3f().
π SbVec3f operator- (const SbVec3f & v1, const SbVec3f & v2) [friend]
Returns an SbVec3f instance which is vector v2 subtracted from vector v1.
References: SbVec3f().
π int operator== (const SbVec3f & v1, const SbVec3f & v2) [friend]
Returns 1 if v1 and v2 are exactly equal, 0 otherwise.
See also
equals().
References: SbVec3f().
π int operator!= (const SbVec3f & v1, const SbVec3f & v2) [friend]
Returns 1 if v1 and v2 are not equal, 0 if they are equal.
See also
equals().
References: SbVec3f().
π Author π
Generated automatically by Doxygen for Coin from the source code.
And that's the whole friend-zone tour, bestie. The footer is giving Coin, Version 2.5.0, and SbVec3f(3) β so this is the official manpage, just with extra glitter and zero chill. Slay. π
β¨π¦
π¦ where this page comes from
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.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