java.lang.Object
org.openpatch.scratch.extensions.shape.Shape
org.openpatch.scratch.extensions.shape.Polygon

public class Polygon extends Shape
Represents a polygon shape defined by its vertices.
  • Constructor Details

    • Polygon

      public Polygon()
      Creates an empty polygon.
    • Polygon

      public Polygon(double[] xPoints, double[] yPoints)
      Creates a polygon with the specified vertices.
      Parameters:
      xPoints - an array of x-coordinates
      yPoints - an array of y-coordinates
  • Method Details

    • addPoint

      public void addPoint(double x, double y)
      Adds a point to the polygon.
      Parameters:
      x - the x-coordinate
      y - the y-coordinate