com.badlogic.gdx.math
Class ConvexHull

java.lang.Object
  extended by com.badlogic.gdx.math.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).

Author:
Nathan Sweet

Constructor Summary
ConvexHull()
           
 
Method Summary
 FloatArray computePolygon(float[] polygon, boolean sorted)
           
 FloatArray computePolygon(float[] points, int offset, int count, boolean sorted)
          Returns the convex hull polygon for the given point cloud.
 FloatArray computePolygon(FloatArray points, boolean sorted)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvexHull

public ConvexHull()
Method Detail

computePolygon

public FloatArray computePolygon(FloatArray points,
                                 boolean sorted)
See Also:
computePolygon(float[], int, int, boolean)

computePolygon

public FloatArray computePolygon(float[] polygon,
                                 boolean sorted)
See Also:
computePolygon(float[], int, int, boolean)

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.


Copyright © 2013. All Rights Reserved.