Provided by: libcoin80-doc_3.1.4~abc9f50-4ubuntu2_all

**NAME**

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

**SYNOPSIS**

PublicMemberFunctionsSbLine(void)SbLine(constSbVec3f&origin, constSbVec3f&point) voidsetValue(constSbVec3f&origin, constSbVec3f&point) voidsetPosDir(constSbVec3f&position, constSbVec3f&direction) SbBoolgetClosestPoints(constSbLine&line2,SbVec3f&ptOnThis,SbVec3f&ptOnLine2) constSbVec3fgetClosestPoint(constSbVec3f&point) const constSbVec3f&getPosition(void) const constSbVec3f&getDirection(void) const void

**Detailed** **Description**

TheSbLineclass represents a line in 3D space.SbLineprovides 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 anSbLineis considered as arayextending from the starting point in only one direction, or as alineintersecting the origin point and extending infinitely from it in both directions.SbLineis used by many other classes in Coin.SeeAlso:SbVec3f

**Constructor** **&** **Destructor** **Documentation**

SbLine::SbLine(void)The default constructor does nothing. The line will be uninitialized until the first assignment orsetValue()call.SbLine::SbLine(constSbVec3f&origin,constSbVec3f&point)Constructor withoriginspecifying the line origin point, andpointspecifying another point on the line that is used to determine the line's direction.pointshould not be the same asorigin, 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 aspoint-origin.SeeAlso:setValue, getOrigin,getDirection

**Member** **Function** **Documentation**

voidSbLine::setValue(constSbVec3f&origin,constSbVec3f&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.pointshould not be the same asorigin, 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 aspoint-origin.SeeAlso:setValue, getOrigin,getDirectionvoidSbLine::setPosDir(constSbVec3f&position,constSbVec3f&direction)Set position and directionSince:Coin 4.0SbBoolSbLine::getClosestPoints(constSbLine&line2,SbVec3f&ptOnThis,SbVec3f&ptOnLine2)constReturns 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 inptOnThisandptOnLine2, and we'll return TRUE. Note that bothSbLineinstances are considered to be infinite in both directions from their definition points, as far as this function is concerned.SeeAlso:getClosestPoint().SbVec3fSbLine::getClosestPoint(constSbVec3f&point)constReturns the point on the line which is closest topoint:_ 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 bypointand the returned point will be normal to the line. Note that theSbLineinstance is considered to be infinite in both directions from its definition point, as far as this function is concerned.SeeAlso:getClosestPoints().constSbVec3f&SbLine::getPosition(void)constReturn a vector representing the origin point on the line.SeeAlso:setValueconstSbVec3f&SbLine::getDirection(void)constReturn a vector representing the direction of the line. The direction vector will always be normalized.voidSbLine::print(FILE*fp)constDump the state of this object to thefilestream. Only works in debug version of library, method does nothing in an optimized compile.

**Author**

Generated automatically by Doxygen for Coin from the source code.