Class Line3

All Implemented Interfaces:
Poolable, ReadOnlyLine3, ReadOnlyLine3Base, Savable, Externalizable, Serializable

public class Line3 extends Line3Base implements ReadOnlyLine3, Poolable
See Also:
  • Constructor Details

    • Line3

      public Line3()
      Constructs a new line with an origin at (0,0,0) and a direction of (0,0,1).
    • Line3

      public Line3(ReadOnlyVector3 origin, ReadOnlyVector3 direction)
      Constructs a new line using the supplied origin point and unit length direction vector
      Parameters:
      origin - the origin of the line.
      direction - the direction of the line. Should be of unit length.
    • Line3

      public Line3(ReadOnlyLine3 source)
      Constructs a new line using the supplied source line
      Parameters:
      source - the source line
  • Method Details

    • set

      public Line3 set(ReadOnlyLine3 source)
      Copies the values of the given source line into this line.
      Parameters:
      source - the source line
      Returns:
      this line for chaining
      Throws:
      NullPointerException - if source is null.
    • distanceSquared

      public double distanceSquared(ReadOnlyVector3 point, Vector3 store)
      Specified by:
      distanceSquared in interface ReadOnlyLine3Base
      Parameters:
      point - the point
      store - if not null, the closest point is stored in this param
      Returns:
      the squared distance from this line to the given point.
      Throws:
      NullPointerException - if the point is null.
    • isValid

      public static boolean isValid(ReadOnlyLine3 line)
      Check a line... if it is null or the values of its origin or direction are NaN or infinite, return false. Else return true.
      Parameters:
      line - the line to check
      Returns:
      true or false as stated above.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      the string representation of this line.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare for equality
      Returns:
      true if this line and the provided line have the same constant and normal values.
    • clone

      public Line3 clone()
      Specified by:
      clone in interface ReadOnlyLine3
      Overrides:
      clone in class Object
    • fetchTempInstance

      public static final Line3 fetchTempInstance()
      Returns:
      An instance of Line3 that is intended for temporary use in calculations and so forth. Multiple calls to the method should return instances of this class that are not currently in use.
    • releaseTempInstance

      public static final void releaseTempInstance(Line3 line)
      Releases a Line3 back to be used by a future call to fetchTempInstance. TAKE CARE: this Line3 object should no longer have other classes referencing it or "Bad Things" will happen.
      Parameters:
      line - the Line3 to release.