Interface Rectangle2d

All Superinterfaces:
Iterable<Vector2d>, Polygon2d
All Known Subinterfaces:
MRectangle2d

public interface Rectangle2d extends Polygon2d
Read-only interface for handling rectangles in the XY-plane.
Since:
9.10.2
  • Method Details

    • getLongerRectangleSegment

      Segment2d getLongerRectangleSegment()
      Returns the longer segment of the rectangle.
      Returns:
      segment the longer segment
      Since:
      9.10.2
    • getLongerRectangleSegments

      List<Segment2d> getLongerRectangleSegments()
      Returns the longer segments of the rectangle.
      Returns:
      segments list with the longer segments
      Since:
      9.10.2
    • getLongerRectangleSegmentLength

      double getLongerRectangleSegmentLength()
      Returns the length of the longer rectangle segment.
      Returns:
      the length of the longer segment
      Since:
      9.10.2
    • getShorterRectangleSegment

      Segment2d getShorterRectangleSegment()
      Returns the shorter segment of the rectangle.
      Returns:
      segment the shorter segment
      Since:
      9.10.2
    • getShorterRectangleSegments

      List<Segment2d> getShorterRectangleSegments()
      Returns the shorter segments of the rectangle.
      Returns:
      segments list with the shorter segments
      Since:
      9.10.2
    • getShorterRectangleSegmentLength

      double getShorterRectangleSegmentLength()
      Returns the length of shorter rectangle segment.
      Returns:
      the length of the shorter segment
      Since:
      9.10.2
    • equalsWithTolerance

      boolean equalsWithTolerance(Rectangle2d rectangle, double epsilon)
      Verifies if two 2D rectangles are equal (with epsilon difference). It checks that the vertices of the rectangles are the same (or in the specified epsilon radius).
      Parameters:
      rectangle - the rectangle to compare to
      epsilon - the tolerance radius
      Returns:
      true is they are epsilon equal, false otherwise
    • create

      static Rectangle2d create(List<? extends Vector2d> vertices)
      Creates a new instance from the given points.
      Parameters:
      vertices - list of points to create the rectangle
      Returns:
      a Rectangle2d instance
      Throws:
      IllegalArgumentException - if the points do not form a rectangle
      Since:
      9.10.2
    • create

      static Rectangle2d create(Rectangle2d other)
      Creates a new instance.
      Parameters:
      other - the other rectangle
      Returns:
      the newly created instance
      Since:
      9.10.2