Class SbLine

java.lang.Object
com.openinventor.inventor.SbBasic
com.openinventor.inventor.SbLine

public class SbLine extends SbBasic
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 Details

    • array

      public final float[] array
  • Constructor Details

    • SbLine

      public SbLine(float[] components)
    • SbLine

      public SbLine(SbLine copyFrom)
    • SbLine

      public SbLine(SbVec3f p0, SbVec3f p1)
      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 the setPosDir() method is recommended to avoid floating point precision problems.
    • SbLine

      public SbLine()
      Default constructor. The line is not initialized.
  • Method Details

    • setValue

      public SbLine setValue(float[] components)
    • getValue

      public float[] getValue()
    • setValue

      public void setValue(SbLine copyFrom)
    • setValue

      public SbLine setValue(float[] components, int startIndex)
    • getClosestPoint

      public SbVec3f getClosestPoint(SbVec3f point)
      Returns the closest point on the line to the given point.
    • toArray

      public static SbLine[] toArray(long nativeArray, long length)
    • getClosestPoints

      public SbVec3f[] getClosestPoints(SbLine line2)
      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

      public void setValue(SbLined line)
      Sets line from a double precision line.
    • setValue

      public void setValue(SbVec3f p0, SbVec3f p1)
      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

      public void setPosDir(SbVec3f position, SbVec3f direction)
      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

      public SbVec3f getPosition()
      Returns position of line origin point.
    • getDirection

      public SbVec3f getDirection()
      Returns direction vector of line.