Interface Line2d

All Known Subinterfaces:
MLine2d

public interface Line2d
Read-only interface for handling lines in 2-dimensional space.
Since:
9.10.2
  • Method Details

    • distance

      double distance​(Vector2d point)
      Returns the distance of a point from this line.
      Parameters:
      point - the point
      Returns:
      the distance of a point from this line
      Since:
      9.10.2
    • distanceSquared

      double distanceSquared​(Vector2d point)
      Returns the squared distance of a point from this line.
      Parameters:
      point - the point
      Returns:
      the squared distance of a point from this line
      Since:
      9.10.2
    • getDirection

      Vector2d getDirection()
      Returns the normalized direction vector of this line.
      Returns:
      the normalized direction vector of this line
      Since:
      9.10.2
    • getFirstPoint

      Vector2d getFirstPoint()
      Returns the first bootstrapping point of this line.
      Returns:
      the first bootstrapping point of this line
      Since:
      9.10.2
    • intersect

      Optional<MVector2d> intersect​(Line2d otherLine)
      Calculates an Optional containing the intersection point of this line and another line. The Optional is empty if the lines don't intersect.
      Parameters:
      otherLine - the other line
      Returns:
      an optional containing the intersection point
      Since:
      9.10.2
    • project

      MVector2d project​(Vector2d point)
      Returns the projection of the given point onto this line.
      Parameters:
      point - the point that is projected onto this line
      Returns:
      the projection of the given point onto this line
      Since:
      9.10.2
    • getSecondPoint

      Vector2d getSecondPoint()
      Returns the second bootstrapping point of this line.
      Returns:
      the second bootstrapping point of this line
      Since:
      9.10.2
    • isPointOnLeftSide

      boolean isPointOnLeftSide​(Vector2d point)
      Returns true if the given point is on the left side of this line when looking in the direction of the vector returned by the getDirection() method.
      Parameters:
      point - the point whose side is checked
      Returns:
      true if the given point is on the left side of this line
      Since:
      9.10.2
    • isPointOnRightSide

      boolean isPointOnRightSide​(Vector2d point)
      Returns true if the given point is on the right side of this line when looking in the direction of the vector returned by the getDirection() method.
      Parameters:
      point - the point whose side is checked
      Returns:
      true if the given point is on the right side of this line
      Since:
      9.10.2
    • create

      static Line2d create​(Vector2d firstPoint, Vector2d secondPoint)
      Creates a new instance.
      Parameters:
      firstPoint - the first point
      secondPoint - the second point
      Returns:
      a Line2d instance
      Since:
      9.10.2