Class Polygons2D

java.lang.Object
inra.ijpb.geometry.Polygons2D

public class Polygons2D
extends java.lang.Object
A set of static methods operating on polygons.
Author:
dlegland
  • Method Summary

    Modifier and Type Method Description
    static Polygon2D convexHull​(java.util.ArrayList<? extends java.awt.geom.Point2D> points)
    Uses the gift wrap algorithm with floating point values to find the convex hull and returns it as a list of points.
    static java.util.ArrayList<java.awt.Point> convexHull_int​(java.util.ArrayList<java.awt.Point> points)
    Uses the gift wrap algorithm with integer values to find the convex hull of a list of vertices, and returns it as an ordered list of points.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • convexHull

      public static final Polygon2D convexHull​(java.util.ArrayList<? extends java.awt.geom.Point2D> points)
      Uses the gift wrap algorithm with floating point values to find the convex hull and returns it as a list of points. Uses Jarvis algorithm, also known as "Gift wrap" algorithm. Code from ij.gui.PolygonRoi.getConvexHull(), adapted to return a polygon oriented counter-clockwise. Uses floating point computation with specific processing of aligned vertices.
      Parameters:
      points - a set of points coordinates in the 2D space
      Returns:
      the convex hull of the points, as a list of ordered vertices
    • convexHull_int

      public static final java.util.ArrayList<java.awt.Point> convexHull_int​(java.util.ArrayList<java.awt.Point> points)
      Uses the gift wrap algorithm with integer values to find the convex hull of a list of vertices, and returns it as an ordered list of points. Code from ij.gui.PolygonRoi.getConvexHull(), adapted to return a list of vertices oriented counter-clockwise.
      Parameters:
      points - a set of points with integer coordinates in the 2D space
      Returns:
      the convex hull of the points, as a list of ordered vertices with integer coordinates