Class V3D_LineSegment

All Implemented Interfaces:
java.io.Serializable, V3D_FiniteGeometry
Direct Known Subclasses:
V3D_EnvelopeEdge

public class V3D_LineSegment
extends V3D_Line
implements V3D_FiniteGeometry
Class for a line segment in 3D represented by two Point3D instances. Two instances are regarded as equal i they are represented by the same points irrespective as which is assigned as V3D_Line.p and which is assigned as V3D_Line.q.
Version:
1.0
Author:
Andy Turner
See Also:
Serialized Form
  • Field Details

  • Constructor Details

  • Method Details

    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class V3D_Line
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class V3D_Line
    • getUnitVector

      public V3D_Vector getUnitVector​(int scale, java.math.RoundingMode rm)
      For getting the unit vector of this line to scale precision using rm if necessary.
      Parameters:
      scale - The scale for the precision of the result.
      rm - The RoundingMode for any rounding.
      Returns:
      The unit vector of this line to scale precision using rm if necessary.
    • initUnitVector

      public V3D_Vector initUnitVector​(int scale, java.math.RoundingMode rm)
      For initialising and returning the unit vector of this line to scale precision using rm if necessary.
      Parameters:
      scale - The scale for the precision of the result.
      rm - The RoundingMode for any rounding.
      Returns:
      The unit vector of this line to scale precision using rm if necessary.
    • multiply

      public V3D_LineSegment multiply​(ch.obermuhlner.math.big.BigRational s)
      Parameters:
      s - The scaler value to multiply each coordinate of this by.
      Returns:
      this multiplied by scalar
    • getLength

      public java.math.BigDecimal getLength​(int scale, java.math.RoundingMode rm)
      Parameters:
      scale - The scale for the precision of the result.
      rm - The RoundingMode for any rounding.
      Returns:
      The length of this as a BigDecimal
    • getEnvelope

      public V3D_Envelope getEnvelope()
      Specified by:
      getEnvelope in interface V3D_FiniteGeometry
      Returns:
      new V3D_Envelope(start, end)
    • isIntersectedBy

      public boolean isIntersectedBy​(V3D_Point p)
      Overrides:
      isIntersectedBy in class V3D_Line
      Parameters:
      p - A point to test for intersection within the specified tolerance.
      Returns:
      true if p is within t of this given scale.
    • isIntersectedBy

      public boolean isIntersectedBy​(V3D_LineSegment l)
      Parameters:
      l - A line to test for intersection within the specified tolerance.
      Returns:
      true if p is within t of this given scale.
    • getIntersection

      public V3D_Geometry getIntersection​(V3D_LineSegment l)
      Intersects this with l. If they are equivalent then return this. If they overlap in a line return the part that overlaps (the order of points is not defined). If they intersect at a point, the point is returned. null is returned if the two line segments do not intersect.
      Parameters:
      l - The line to get intersection with this.
      Returns:
      The intersection between this and l.
    • getIntersection

      public static V3D_Geometry getIntersection​(V3D_LineSegment l0, V3D_LineSegment l1)