Package com.openinventor.inventor
Class SbLine
java.lang.Object
com.openinventor.inventor.SbBasic
com.openinventor.inventor.SbLine
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:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClosestPoint
(SbVec3f point) Returns the closest point on the line to the given point.SbVec3f[]
getClosestPoints
(SbLine line2) Finds the two closest points between this line and line2, and loads them into ptOnThis and ptOnLine2.Returns direction vector of line.Returns position of line origin point.float[]
getValue()
static void
setIntersectEpsilon
(float epsilon) Setup epsilon to detect intersection of very small geometry.void
Sets line using a position and a direction vector.setValue
(float[] components) setValue
(float[] components, int startIndex) void
void
Sets line from a double precision line.void
Sets line to pass through points p0 and p1.static SbLine[]
toArray
(long nativeArray, long length)
-
Field Details
-
array
public final float[] array
-
-
Constructor Details
-
SbLine
public SbLine(float[] components) -
SbLine
-
SbLine
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 thesetPosDir()
method is recommended to avoid floating point precision problems. -
SbLine
public SbLine()Default constructor. The line is not initialized.
-
-
Method Details
-
setValue
-
getValue
public float[] getValue() -
setValue
-
setValue
-
getClosestPoint
Returns the closest point on the line to the given point. -
toArray
-
getClosestPoints
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. -
setValue
Sets line from a double precision line. -
setValue
Sets line to pass through points p0 and p1. -
setIntersectEpsilon
public static void setIntersectEpsilon(float epsilon) Setup epsilon to detect intersection of very small geometry. -
setPosDir
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. -
getPosition
Returns position of line origin point. -
getDirection
Returns direction vector of line.
-