Class Jarvis


  • public class Jarvis
    extends java.lang.Object
    Provides utility methods for computing the convex hull of a list of n points.

    The implementation uses the Jarvis march algorithm and runs in O(nh) time in the worst case, where n is the number of points and h the number of points on the convex hull.

    • Constructor Summary

      Constructors 
      Constructor Description
      Jarvis()  
    • Constructor Detail

      • Jarvis

        public Jarvis()
    • Method Detail

      • convexHull

        @Deprecated
        public static java.util.List<Point> convexHull​(java.util.List<Point> points)
        Deprecated.
        Computes and returns the convex hull of the passed points.

        The size of the list must be at least 3, otherwise this method will return null.

        Parameters:
        points - list of points
        Returns:
        list containing the points part of the convex hull
      • convexHull

        public static SimplePolygon convexHull​(int[] xs,
                                               int[] ys)
        Computes and returns the convex hull of the passed points.

        The size of the list must be at least 3, otherwise this method will return null.

        Returns:
        a shape the points part of the convex hull