Class Polygon
java.lang.Object
org.openpatch.scratch.extensions.shape.Shape
org.openpatch.scratch.extensions.shape.Polygon
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-coordinatesyPoints
- 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-coordinatey
- the y-coordinate
-