Main Page Modules Class Hierarchy Alphabetical List Compound List File List Compound Members

# SbLine Class Reference
[Base classes]

The SbLine class represents a line in 3D space. More...

`#include <Inventor/SbLinear.h>`

List of all members.

## Public Methods
| 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.

SbLine is used by many other classes in Coin. It provides a way of specifying a directed line through a specified point (origin) and a direction in 3D space. Note that the line is infinite in both directions from its definition point as far as the getClosestPoint() functions are concerned.

See also:
  SbVec3f

## Constructor & Destructor Documentation

SbLine::SbLine | ( | void |  | ) |

| The empty constructor does nothing. The line will be uninitialized until the first assignment or setValue() call.

SbLine::SbLine | ( | const SbVec3f & | origin,
|  | const SbVec3f & | point
| ) |

| Constructor with origin specifying the line origin point, and point specifying another point on the line that is used to determine the line's direction. point should not be the same as origin, as this will lead to the line having a null vector as the direction vector. This will cause division by zero problems in some of the other methods on this class. Be aware that the direction vector will be normalized and not be the same as point - origin. See also: setValue, getOrigin, getDirection

## Member Function Documentation

void SbLine::setValue | ( | const SbVec3f & | origin,
|  | const SbVec3f & | point
| ) |

| Set new position and direction of the line by specifying line origin and another point on the line that is used to determine the line's direction. point should not be the same as origin, as this will lead to having a null vector as the direction vector. This will cause division by zero problems in some of the other methods on this class. Be aware that the direction vector will be normalized and not be the same as point - origin. See also: setValue, getOrigin, getDirection

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`. If the lines are not parallel, the point positions will be stored in ptOnThis and ptOnLine2, and we'll return `TRUE`. See also: getClosestPoint().

SbVec3f SbLine::getClosestPoint | ( | const SbVec3f & | point | ) | const

| Returns the point on the line which is closest to point. See also: getClosestPoints().

const SbVec3f & SbLine::getPosition | ( | void |  | ) | const

| Return a vector representing the origin point on the line. See also: setValue

const SbVec3f & SbLine::getDirection | ( | void |  | ) | const

| Return a vector representing the direction of the line. The direction vector will always be normalized.

void SbLine::print | ( | FILE * | fp | ) | const

| Dump the state of this object to the file stream. Only works in debug version of library, method does nothing in an optimized compile.

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

- SbLine.h
- SbLine.cpp