Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SbLine Class Reference

Directed line in 3D. More...

#include <Inventor/SbLine.h>

Public Member Functions

 SbLine ()
 Default constructor.
 
 SbLine (const SbVec3f &p0, const SbVec3f &p1)
 Constructor.
 
void setValue (const SbVec3f &p0, const SbVec3f &p1)
 Sets line to pass through points p0 and p1.
 
void setPosDir (const SbVec3f &position, const SbVec3f &direction)
 Sets line using a position and a direction vector.
 
void setValue (const SbLined &line)
 Sets line from a double precision line.
 
SbBool getClosestPoints (const SbLine &line2, SbVec3f &ptOnThis, SbVec3f &ptOnLine2) const
 Finds the two closest points between this line and line2, and loads them into ptOnThis and ptOnLine2.
 
SbVec3f getClosestPoint (const SbVec3f &point) const
 Returns the closest point on the line to the given point.
 
const SbVec3fgetPosition () const
 Returns position of line origin point.
 
const SbVec3fgetDirection () const
 Returns direction vector of line.
 

Static Public Member Functions

static void setIntersectEpsilon (const float epsilon)
 Setup epsilon to detect intersection of very small geometry.
 

Detailed Description

Directed line in 3D.

Represents a directed line in 3D. This is a basic Open Inventor datatype that is used for representing a 3D line. It is used as input and output by a variety of Open Inventor classes.

SEE ALSO

SbVec3f, SbPlane

Definition at line 57 of file SbLine.h.

Constructor & Destructor Documentation

◆ SbLine() [1/2]

SbLine::SbLine ( )
inline

Default constructor.

The line is not initialized.

Definition at line 62 of file SbLine.h.

◆ SbLine() [2/2]

SbLine::SbLine ( const SbVec3f p0,
const SbVec3f p1 
)

Constructor.

The line is directed from p0 to p1.
To construct a line from a position and direction you can use: SbLine(p0, p0 + dir), but using the default constructor followed by the setPosDir() method is recommended to avoid floating point precision problems.

Member Function Documentation

◆ getClosestPoint()

SbVec3f SbLine::getClosestPoint ( const SbVec3f point) const

Returns the closest point on the line to the given point.

◆ getClosestPoints()

SbBool SbLine::getClosestPoints ( const SbLine line2,
SbVec3f ptOnThis,
SbVec3f ptOnLine2 
) const

Finds the two closest points between this line and line2, and loads them into ptOnThis and ptOnLine2.

Returns FALSE if the lines are parallel (results undefined), and returns TRUE otherwise.

◆ getDirection()

const SbVec3f & SbLine::getDirection ( ) const
inline

Returns direction vector of line.

Definition at line 113 of file SbLine.h.

◆ getPosition()

const SbVec3f & SbLine::getPosition ( ) const
inline

Returns position of line origin point.

Definition at line 108 of file SbLine.h.

◆ setIntersectEpsilon()

static void SbLine::setIntersectEpsilon ( const float  epsilon)
static

Setup epsilon to detect intersection of very small geometry.

◆ setPosDir()

void SbLine::setPosDir ( const SbVec3f position,
const SbVec3f direction 
)

Sets line using a position and a direction vector.

The direction vector will be normalized automatically. This method is preferred over setValue when the point has very large magnitude, for example 1e6, because adding a normalized direction vector to such a point may not be significant.

◆ setValue() [1/2]

void SbLine::setValue ( const SbLined line)
inline

Sets line from a double precision line.

Definition at line 278 of file SbLine.h.

◆ setValue() [2/2]

void SbLine::setValue ( const SbVec3f p0,
const SbVec3f p1 
)

Sets line to pass through points p0 and p1.


The documentation for this class was generated from the following file: