Class Shape

java.lang.Object
ch.epfl.cs107.play.math.shape.Shape
Direct Known Subclasses:
Circle, Polygon, Polyline

public abstract class Shape extends Object
Base class of all physical shapes.
  • Constructor Details

    • Shape

      public Shape()
  • Method Details

    • getArea

      public abstract float getArea()
      Returns:
      shape area
    • getPerimeter

      public abstract float getPerimeter()
      Returns:
      shape perimeter
    • sample

      public abstract Vector sample()
      Sample uniform point inside shape, including border.
      Returns:
      (Vector): a uniform sample, not null
    • toPath

      public abstract Path2D toPath()
      Returns:
      (Path2D): AWT path used for drawing