Package com.badlogic.gdx.math
Class ConvexHull
- java.lang.Object
-
- com.badlogic.gdx.math.ConvexHull
-
public class ConvexHull extends java.lang.ObjectComputes the convex hull of a set of points using the monotone chain convex hull algorithm (aka Andrew's algorithm).
-
-
Constructor Summary
Constructors Constructor Description ConvexHull()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntArraycomputeIndices(float[] polygon, boolean sorted, boolean yDown)IntArraycomputeIndices(float[] points, int offset, int count, boolean sorted, boolean yDown)Computes a hull the same ascomputePolygon(float[], int, int, boolean)but returns indices of the specified points.IntArraycomputeIndices(FloatArray points, boolean sorted, boolean yDown)FloatArraycomputePolygon(float[] polygon, boolean sorted)FloatArraycomputePolygon(float[] points, int offset, int count, boolean sorted)Returns the convex hull polygon for the given point cloud.FloatArraycomputePolygon(FloatArray points, boolean sorted)
-
-
-
Method Detail
-
computePolygon
public FloatArray computePolygon(FloatArray points, boolean sorted)
-
computePolygon
public FloatArray computePolygon(float[] polygon, boolean sorted)
-
computePolygon
public FloatArray 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 IntArray computeIndices(FloatArray points, boolean sorted, boolean yDown)
-
computeIndices
public IntArray computeIndices(float[] polygon, boolean sorted, boolean yDown)
-
computeIndices
public IntArray computeIndices(float[] points, int offset, int count, boolean sorted, boolean yDown)
Computes a hull the same ascomputePolygon(float[], int, int, boolean)but returns indices of the specified points.
-
-