java.lang.Object
org.htmlunit.util.geometry.Polygon2D
- All Implemented Interfaces:
Shape2D
Simple 2D polygon shape.
- Author:
- Ronald Brill
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionPolygon2D(double startX, double startY) Creates a new polygon starting at the given point. -
Method Summary
-
Constructor Details
-
Polygon2D
public Polygon2D(double startX, double startY) Creates a new polygon starting at the given point. UselineTo(double, double)to add further corner points.- Parameters:
startX- the x coordinate of the first pointstartY- the y coordinate of the first point
-
-
Method Details
-
lineTo
Adds another corner point to the polygon.- Parameters:
x- the x coordinate of the corner to addy- the y coordinate of the corner to add- Returns:
- this instance to support fluent-style construction
-
contains
public boolean contains(double x, double y) Returns whether the specified point lies inside this shape. -
isEmpty
public boolean isEmpty()Returns whether this shape is empty. -
toString
-