Package arc.math.geom

Class ConvexHull

java.lang.Object
arc.math.geom.ConvexHull

public class ConvexHull extends Object
Computes the convex hull of a set of points using the monotone chain convex hull algorithm (aka Andrew's algorithm).
  • Constructor Details

    • ConvexHull

      public ConvexHull()
  • Method Details

    • computePolygon

      public FloatSeq computePolygon(FloatSeq points, boolean sorted)
      See Also:
    • computePolygon

      public FloatSeq computePolygon(float[] polygon, boolean sorted)
      See Also:
    • computePolygon

      public FloatSeq computePolygon(float[] points, int offset, int count, boolean sorted)
      Returns the convex hull polygon for the given point cloud.
      Parameters:
      points - x,y pairs describing points. Duplicate points will result in undefined behavior.
      sorted - If false, the points will be sorted by the x coordinate then the y coordinate, which is required by the convex hull algorithm. If sorting is done the input array is not modified and count additional working memory is needed.
      Returns:
      pairs of coordinates that describe the convex hull polygon in counterclockwise order. Note the returned array is reused for later calls to the same method.
    • computeIndices

      public IntSeq computeIndices(FloatSeq points, boolean sorted, boolean yDown)
      See Also:
    • computeIndices

      public IntSeq computeIndices(float[] polygon, boolean sorted, boolean yDown)
      See Also:
    • computeIndices

      public IntSeq computeIndices(float[] points, int offset, int count, boolean sorted, boolean yDown)
      Computes a hull the same as computePolygon(float[], int, int, boolean) but returns indices of the specified points.