SbLine(3)

πŸ“¦ version 2.5.0, in fedora 43, fedora 44

πŸ’– 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 ptOnThis and ptOnLine2, and we return TRUE. 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