Class Polygon2D

java.lang.Object
org.htmlunit.util.geometry.Polygon2D
All Implemented Interfaces:
Shape2D

public class Polygon2D extends Object implements Shape2D
Simple 2D shape polygon.
  • Field Details

  • Constructor Details

    • Polygon2D

      public Polygon2D(double startX, double startY)
      Ctor.
      Parameters:
      startX - the x value of the first point.
      startY - the Y value of the first point.
      See Also:
  • Method Details

    • lineTo

      public Polygon2D lineTo(double x, double y)
      Add another corner Point to the polygon.
      Parameters:
      x - the x value of the corner to be added
      y - the y value of the corner to be added
      Returns:
      this to support fluent style construction
    • contains

      public boolean contains(double x, double y)
      Specified by:
      contains in interface Shape2D
      Parameters:
      x - point x value
      y - point y value
      Returns:
      true if the specified point is inside; false otherwise.
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Shape2D
      Returns:
      true if the Shape is empty.
    • toString

      public String toString()
      Overrides:
      toString in class Object