SbLine(3)
π SbLine β bestie, we're doing 3D lines today π
so this page is SbLine(3) out of Coin's Library Functions Manual, and honestly? it ate. let's get into it π
β¨ NAME β¨
SbLine β the SbLine class represents a line in 3D space. that's it. that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
#include <Inventor/SbLinear.h>
π Public Member Functions π
SbLine (void)
SbLine (const SbVec3f &origin, const SbVec3f &point)
void setValue (const SbVec3f &origin, const SbVec3f &point)
SbBool getClosestPoints (const SbLine &line2, SbVec3f &ptOnThis, SbVec3f &ptOnLine2) const
SbVec3f getClosestPoint (const SbVec3f &point) const
const SbVec3f & getPosition (void) const
const SbVec3f & getDirection (void) const
void print (FILE *file) const
π Detailed Description π
The SbLine class represents a line in 3D space. no cap.
SbLine gives you a way to specify a directed line, through a 3D point (the origin) and a vector direction in 3D space. iconic behaviour honestly.
and here's the thing β it's context dependent whether an SbLine counts as a ray that starts at the starting point and shoots off in only one direction, or as a line that intersects the origin point and extends infinitely from it in both directions. so like... read the room, the class will not decide for you. π
SbLine is used by many other classes in Coin. she's popular, she's booked, she's everywhere. π
π«Ά See also
SbVec3f
π§ Constructor & Destructor Documentation π§
SbLine::SbLine (void)
The default constructor does nothing. the line will be uninitialized until the first assignment or setValue() call. so don't come at her expecting a line, she's just a girl standing in front of a void rn. π
Referenced by getClosestPoints().
SbLine::SbLine (const SbVec3f & origin, const SbVec3f & point)
Constructor where origin is the line's origin point, and point is another point on the line that gets used to figure out the line's direction.
point should not be the same as origin, bestie!! because then the line ends up with a null vector as its direction vector, and that causes division by zero problems in some of the other methods on this class. we do not want that energy. π
also be aware that the direction vector will be normalized, and it will not be the same as point - origin. so don't be surprised, she did a little glow-up on the way in. β¨
See also
setValue, getOrigin, getDirection
References setValue().
π₯ Member Function Documentation π₯
void SbLine::setValue (const SbVec3f & origin, const SbVec3f & point)
Sets a new position and direction for the line by specifying the line origin plus another point on the line that's used to determine the line's direction.
point should not be the same as origin, because that gives you a null vector as the direction vector, and that will cause division by zero problems in some of the other methods on this class. seriously. we warned you twice. π
and again β be aware that the direction vector will be normalized and will not be the same as point - origin.
See also
setValue, getOrigin, getDirection
References SbVec3f::normalize(), and SoDebugError::postWarning().
Referenced by SbMatrix::multLineMatrix(), SbSphereSheetProjector::project(), SbViewVolume::projectPointToLine(), and SbLine().
SbBool SbLine::getClosestPoints (const SbLine & line2, SbVec3f & ptOnThis, SbVec3f & ptOnLine2) const
Returns the two closest points on the lines. π«Ά
- If the lines are parallel, all points are equally close and we return
FALSE. (no notes, they're equidistant, it's giving parallel lines energy.) - If the lines are not parallel, the point positions get stored in
ptOnThisandptOnLine2, and we returnTRUE. slay.
note that as far as this function is concerned, both SbLine instances are considered to be infinite in both directions from their definition points. she does not care about your endpoints. she has no endpoints. π
See also
getClosestPoint().
References getClosestPoint(), getDirection(), SbVec3f::length(), SbVec3f::normalize(), SoDebugError::postWarning(), and SbLine().
Referenced by SbViewVolume::intersect(), and SbPlaneProjector::project().
SbVec3f SbLine::getClosestPoint (const SbVec3f & point) const
Returns the point on the line which is closest to point:
_
Q D
SP x-----x------->
\ |
\ |
\ |
\ |
\|
x P
P = argument point _
SP = line starting point, and D = line direction of this line
Q = point to find and return from function
The vector defined by point and the returned point will be normal to the line. geometry said perpendicular rights. π
note that as far as this function is concerned, the SbLine instance is considered to be infinite in both directions from its definition point. no ends, only vibes. β
See also
getClosestPoints().
References SbVec3f::length(), and SoDebugError::postWarning().
Referenced by SoHandleBoxDragger::dragStart(), SoRotateCylindricalDragger::dragStart(), SoTransformerDragger::dragStart(), SoVRMLCylinderSensor::dragStart(), getClosestPoints(), SbCylinderPlaneProjector::getRotation(), SbCylinderSectionProjector::getRotation(), SbCylinderSheetProjector::getRotation(), SbLineProjector::project(), SoText2::rayPick(), SbCylinderSheetProjector::setupPlane(), and SbCylinderSectionProjector::setupTolerance().
const SbVec3f & SbLine::getPosition (void) const
Returns a vector representing the origin point on the line. that's her starting point, her hometown, where she came from. π
See also
setValue
Referenced by SoRayPickAction::computeWorldSpaceRay(), SbCylinder::intersect(), SbPlane::intersect(), SbSphere::intersect(), SbMatrix::multLineMatrix(), print(), SbLineProjector::project(), SbPlaneProjector::project(), SbCylinderSheetProjector::setupPlane(), and SbCylinderSectionProjector::setupTolerance().
const SbVec3f & SbLine::getDirection (void) const
Returns a vector representing the direction of the line. the direction vector will always be normalized. always. she is consistent, she is reliable, she is that girl. β¨
Referenced by SoRayPickAction::computeWorldSpaceRay(), getClosestPoints(), SbCylinderSectionProjector::getRotation(), SbCylinderSheetProjector::getRotation(), SbCylinder::intersect(), SbPlane::intersect(), SbSphere::intersect(), SbMatrix::multLineMatrix(), print(), SbLineProjector::project(), SbPlaneProjector::project(), SbSphereSheetProjector::project(), SbCylinder::setAxis(), and SbCylinderSectionProjector::setupTolerance().
void SbLine::print (FILE * fp) const
Dumps the state of this object to the file stream. β οΈ only works in the debug version of the library β in an optimized compile, this method does nothing. so if you're sitting there like "why is my file empty", bestie, that's why. π
References getDirection(), getPosition(), and SbVec3f::print().
Referenced by SbCylinder::print().
π Author π
Generated automatically by Doxygen for Coin from the source code. yes, a robot wrote this, and she still served. π€π
and that's the whole page, bestie!! thanks for reading, mwah π«Ά
Coin β Version 2.5.0 β SbLine(3) β¨ that's the version and the page name, signed, sealed, delivered, periodt. π
π¦ 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