Interface Shape

All Known Implementing Classes:
Circle, Line, Polygon, Rect, SegmentedLine

public interface Shape
Shared interface for all two-dimensional shapes. Shapes use coordinates with float precision, and instances are immutable.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether this shape contains the specified point.
    Returns the smallest possible rectangular bounding box that can fit this shape.
    default Shape
    reposition(float offsetX, float offsetY)
    Returns a new Shape instance that is repositioned by the specified X and Y offset.
    Returns a new Shape instance that is repositioned by the specified X and Y offset.
  • Field Details

  • Method Details

    • contains

      boolean contains(Point2D p)
      Returns whether this shape contains the specified point.
    • getBoundingBox

      Rect getBoundingBox()
      Returns the smallest possible rectangular bounding box that can fit this shape.
    • reposition

      Shape reposition(Point2D offset)
      Returns a new Shape instance that is repositioned by the specified X and Y offset.
    • reposition

      default Shape reposition(float offsetX, float offsetY)
      Returns a new Shape instance that is repositioned by the specified X and Y offset.