Class Polygon


  • public class Polygon
    extends Object
    This class defines a polygon.
    • Constructor Detail

      • Polygon

        public Polygon()
        Constructs an empty polygon.
      • Polygon

        public Polygon​(List<Point> points)
        Constructs a new polygon.
        Parameters:
        points - the points
      • Polygon

        public Polygon​(Point... points)
        Constructs a new polygon.
        Parameters:
        points - the points
    • Method Detail

      • getPoints

        public List<Point> getPoints()
        Returns the points for this polygon
        Returns:
        the points for this polygon
      • setPoints

        public void setPoints​(List<Point> points)
        Sets the points.
        Parameters:
        points - the points
      • setPoints

        public void setPoints​(Point... points)
        Sets the points.
        Parameters:
        points - the points
      • addPoints

        public void addPoints​(Point... points)
        Adds the specified points.
        Parameters:
        points - the points
      • getBounds

        public Rect getBounds()
        Returns the bounding rectangle for this polygon.
        Returns:
        the bounding rectangle for this polygon
      • offset

        public void offset​(double dx,
                           double dy)
        Moves this polygon by the specified offset.
        Parameters:
        dx - the offset along the X axis
        dy - the offset along the Y axis
      • rotate

        public void rotate​(float angle)
        Rotates this polygon by the specified number of degrees around the first point.
        Parameters:
        angle - the angle in degrees