Class Circle

java.lang.Object
ch.epfl.cs107.play.math.shape.Shape
ch.epfl.cs107.play.math.shape.Circle

public final class Circle extends Shape
Represents an immutable circle.
  • Constructor Details

    • Circle

      public Circle(float radius, Vector center)
      Creates a new circle.
      Parameters:
      radius - (float): size, not negative
      center - (Vector): origin, not null
    • Circle

      public Circle(float radius)
      Creates a new circle.
      Parameters:
      radius - (float): size, not negative
  • Method Details

    • getRadius

      public float getRadius()
      Returns:
      (float): size of circle
    • getCenter

      public Vector getCenter()
      Returns:
      (Vector): origin of circle, not null
    • getArea

      public float getArea()
      Specified by:
      getArea in class Shape
      Returns:
      shape area
    • getPerimeter

      public float getPerimeter()
      Specified by:
      getPerimeter in class Shape
      Returns:
      shape perimeter
    • sample

      public Vector sample()
      Description copied from class: Shape
      Sample uniform point inside shape, including border.
      Specified by:
      sample in class Shape
      Returns:
      (Vector): a uniform sample, not null
    • toPath

      public Path2D toPath()
      Specified by:
      toPath in class Shape
      Returns:
      (Path2D): AWT path used for drawing