Class ConvexHullUtilities

Object
ConvexHullUtilities

public class ConvexHullUtilities extends Object
Utility methods for calculating convex hulls on 2D points.

Strongly influenced by http://rsb.info.nih.gov/ij/macros/ConvexHull.txt

  • Method Details

    • convexHull2D

      public static List<Point2i> convexHull2D(List<Point2i> points) throws OperationFailedException
      Apply a convex-hull algorithm to filter a set of points using the default minimum number of points.
      Parameters:
      points - points to filter
      Returns:
      the filtered points on convex-hull if the minimum number of points exists, otherwise the input points unchanged
      Throws:
      OperationFailedException - if the count variable becomes too high during calculation
    • convexHull2D

      public static List<Point2i> convexHull2D(List<Point2i> points, int minNumberPoints) throws OperationFailedException
      Apply a convex-hull algorithm to filter a set of points.

      Note the algorithm will return the input-points if there are too few points.

      Parameters:
      points - points to filter
      minNumberPoints - a minimum of number of points (before any convex hull filtering) that must be found
      Returns:
      the filtered points on convex-hull if the minimum number of points exists, otherwise the input points unchanged
      Throws:
      OperationFailedException - if the count variable becomes too high during calculation
    • pointsOnAllOutlines

      public static List<Point2i> pointsOnAllOutlines(ObjectCollection objects)
      Get points on all outlines of a collection of objects.
      Parameters:
      objects - the collection of objects
      Returns:
      a list of Point2i representing points on all outlines
    • pointsOnOutline

      public static List<Point2i> pointsOnOutline(ObjectMask object) throws CreateException
      Get points on the outline of a single object.
      Parameters:
      object - the object mask
      Returns:
      a list of Point2i representing points on the outline
      Throws:
      CreateException - if there's an error creating the point list