Class Polygon

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

public class Polygon extends Shape
A polygon given by its corners, concave ones included. The outline closes by itself.
  • Constructor Details

    • Polygon

      public Polygon()
      A polygon without corners yet; add them with addPoint(double, double).
    • Polygon

      public Polygon(double[] xPoints, double[] yPoints)
      Parameters:
      xPoints - x of every corner
      yPoints - y of every corner, in the same order
  • Method Details

    • addPoint

      public void addPoint(double x, double y)
      Adds a corner after the last one.
      Parameters:
      x - x of the corner
      y - y of the corner