---
name: "SbLine"
section: "3iv"
platform: "linux"
package: "inventor-doc"
version: "2.1.6+ds-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SbLine/3iv"
---

# SbLine(3iv)

directed line in 3D

## NAME

SbLine — directed line in 3D

## INHERITS FROM

SbLine

## SYNOPSIS

**#include \<Inventor/SbLinear.h\>**

Methods from class SbLine:

	**SbLine()**\
 	**SbLine(const SbVec3f &p0, const SbVec3f &p1)**\
 **void**	**setValue(const SbVec3f &p0, const SbVec3f &p1)**\
 **SbBool**	**getClosestPoints(const SbLine &line2, SbVec3f &ptOnThis, SbVec3f &ptOnLine2 ) const**\
 **SbVec3f**	**getClosestPoint(const SbVec3f &point) const**\
 **const SbVec3f &**	**getPosition() const**\
 **const SbVec3f &**	**getDirection() const**

## DESCRIPTION

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

## METHODS

	**SbLine()**\
 	**SbLine(const SbVec3f &p0, const SbVec3f &p1)**\
 Constructors. To construct a line from a position and direction, use: **SbLine(p0, p0 + dir)**. The line is directed from **p0** to **p1**.

**void**	**setValue(const SbVec3f &p0, const SbVec3f &p1)**\
 Sets line to pass through points **p0** and **p1**.

**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**. Returns **FALSE** if the lines are parallel (results undefined), and returns **TRUE** otherwise.

**SbVec3f**	**getClosestPoint(const SbVec3f &point) const**\
 Returns the closest point on the line to the given point.

**const SbVec3f &**	**getPosition() const**\
 **const SbVec3f &**	**getDirection() const**\
 Returns position of line origin point and direction vector of line.

## SEE ALSO

**SbVec3f, SbPlane**
