SbLine

Langue: en

Autres versions - même langue

Version: 322976 (ubuntu - 08/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

SbLine -

SYNOPSIS


#include <Inventor/SbLinear.h>

Detailed Description

The SbLine class represents a line in 3D space.

SbLine provides a way of specifying a directed line, through a 3D point (origin) and a vector direction in 3D space.

It is context dependent whether or not an SbLine is considered as a ray extending from the starting point in only one direction, or as a line intersecting the origin point and extending infinitely from it in both directions.

SbLine is used by many other classes in Coin.

See also:

SbVec3f

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

Constructor & Destructor Documentation

SbLine::SbLine (void)

The default 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

References setValue().

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

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

Note that both SbLine instances are considered to be infinite in both directions from their definition points, as far as this function is concerned.

See also:

getClosestPoint().

References dir, getClosestPoint(), getDirection(), SbVec3f::length(), SbVec3f::normalize(), pos, and SoDebugError::postWarning().

Referenced by SbViewVolume::intersect(), SbPlaneProjector::project(), and SbLineProjector::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
 
   .fi
 
 
 The vector defined by point and the returned point will be normal to the line.
 
 Note that the SbLine instance is considered to be infinite in both directions from its definition point, as far as this function is concerned.
 
 See also:
 
getClosestPoints().

 
 
 
 References SbVec3f::length(), and SoDebugError::postWarning().
 
 Referenced by getClosestPoints(), SbCylinderSheetProjector::getRotation(), SbCylinderSectionProjector::getRotation(), SbCylinderPlaneProjector::getRotation(), SbCylinder::intersect(), SbCylinderProjector::isPointInFront(), SbCylinderSectionProjector::isWithinTolerance(), SbLineProjector::project(), SbCylinderSectionProjector::project(), SbCylinderSheetProjector::setupPlane(), SbCylinderSectionProjector::setupTolerance(), and SoVRMLCylinderSensor::~SoVRMLCylinderSensor().
 
 

const SbVec3f & SbLine::getPosition (void) const

Return a vector representing the origin point on the line.

See also:

setValue

Referenced by SoRayPickAction::computeWorldSpaceRay(), SbCylinderPlaneProjector::getRotation(), SbSphere::intersect(), SbPlane::intersect(), SbCylinder::intersect(), SbMatrix::multLineMatrix(), print(), SbPlaneProjector::project(), SbLineProjector::project(), SbCylinderSheetProjector::setupPlane(), and SbCylinderSectionProjector::setupTolerance().

const SbVec3f & SbLine::getDirection (void) const

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

Referenced by SoRayPickAction::computeWorldSpaceRay(), getClosestPoints(), SbCylinderSheetProjector::getRotation(), SbCylinderSectionProjector::getRotation(), SbCylinderPlaneProjector::getRotation(), SbSphere::intersect(), SbPlane::intersect(), SbCylinder::intersect(), SbMatrix::multLineMatrix(), print(), SbSphereSheetProjector::project(), SbPlaneProjector::project(), SbLineProjector::project(), SbCylinder::setAxis(), and SbCylinderSectionProjector::setupTolerance().

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.

References getDirection(), getPosition(), and SbVec3f::print().

Referenced by SbCylinder::print().

Author

Generated automatically by Doxygen for Coin from the source code.