Class Line

java.lang.Object
io.github.srcimon.screwbox.core.Line
All Implemented Interfaces:
Serializable, Comparable<Line>

public final class Line extends Object implements Serializable, Comparable<Line>
Defines the Line between two Vectors.
See Also:
  • Method Details

    • between

      public static Line between(Vector from, Vector to)
      Creates a new instance of Line defined by the two endpoints.
    • normal

      public static Line normal(Vector from, double length)
      Creates a new instance of Line defined by the starting point and the length of the line goint up from this point.
    • from

      public Vector from()
      The starting point of the Line.
    • to

      public Vector to()
      The endpoint of the Line.
    • intersects

      public boolean intersects(Line other)
      Checks if the two given Lines intersect each other.
      See Also:
    • intersections

      public List<Vector> intersections(List<Line> others)
      Finds all intersections between this Line and the given Lines.
    • intersectionPoint

      public Vector intersectionPoint(Line other)
      Returns the intersection Point of this and the other Line. Returns null if there is no intersection.
      See Also:
    • middle

      public Vector middle()
      Returns the point in the middle of the line.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • length

      public double length()
    • compareTo

      public int compareTo(Line other)
      Specified by:
      compareTo in interface Comparable<Line>