Package net.dermetfan.gdx.math
Class BayazitDecomposer.SimplifyTools
java.lang.Object
net.dermetfan.gdx.math.BayazitDecomposer.SimplifyTools
- Enclosing class:
- BayazitDecomposer
public static class BayazitDecomposer.SimplifyTools
extends java.lang.Object
- 
Constructor SummaryConstructors Constructor Description SimplifyTools()
- 
Method SummaryModifier and Type Method Description static booleancollinear(com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, com.badlogic.gdx.math.Vector2 c, float tolerance)static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2>collinearSimplify(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices)Removes all collinear points on the polygon.static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2>collinearSimplify(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, float collinearityTolerance)Removes all collinear points on the polygon.static java.lang.Floatcross(com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b)static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2>douglasPeuckerSimplify(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, float distanceTolerance)Ramer-Douglas-Peucker polygon simplification algorithm.static booleanfloatInRange(float value, float min, float max)static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2>mergeIdenticalPoints(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices)Merges the identical points in the polygon.static voidmergeParallelEdges(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, float tolerance)From Eric Jordan's convex decomposition library Merges all parallel edges in the list of verticesstatic com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2>reduceByArea(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, float areaTolerance)static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2>reduceByDistance(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, float distance)Reduces the polygon by distance.static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2>reduceByNth(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, int nth)Reduces the polygon by removing the Nth vertex in the vertices list.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Constructor Details- 
SimplifyToolspublic SimplifyTools()
 
- 
- 
Method Details- 
collinearSimplifypublic static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> collinearSimplify(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, float collinearityTolerance)Removes all collinear points on the polygon.- Parameters:
- vertices- The polygon that needs simplification.
- collinearityTolerance- The collinearity tolerance.
- Returns:
- A simplified polygon.
 
- 
collinearpublic static boolean collinear(com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b, com.badlogic.gdx.math.Vector2 c, float tolerance)
- 
floatInRangepublic static boolean floatInRange(float value, float min, float max)
- 
collinearSimplifypublic static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> collinearSimplify(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices)Removes all collinear points on the polygon. Has a default bias of 0- Parameters:
- vertices- The polygon that needs simplification
- Returns:
- A simplified polygon.
 
- 
douglasPeuckerSimplifypublic static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> douglasPeuckerSimplify(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, float distanceTolerance)Ramer-Douglas-Peucker polygon simplification algorithm. This is the general recursive version that does not use the speed-up technique by using the Melkman convex hull. If you pass in 0, it will remove all collinear points- Parameters:
- vertices-
- distanceTolerance-
- Returns:
- The simplified polygon
 
- 
reduceByAreapublic static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> reduceByArea(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, float areaTolerance)
- 
crosspublic static java.lang.Float cross(com.badlogic.gdx.math.Vector2 a, com.badlogic.gdx.math.Vector2 b)
- 
mergeParallelEdgespublic static void mergeParallelEdges(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, float tolerance)From Eric Jordan's convex decomposition library Merges all parallel edges in the list of vertices
- 
mergeIdenticalPointspublic static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> mergeIdenticalPoints(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices)Merges the identical points in the polygon.
- 
reduceByDistancepublic static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> reduceByDistance(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, float distance)Reduces the polygon by distance.- Parameters:
- vertices-
- distance- The distance between points. Points closer than this will be 'joined'
 
- 
reduceByNthpublic static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> reduceByNth(com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> vertices, int nth)Reduces the polygon by removing the Nth vertex in the vertices list.- Parameters:
- vertices-
- nth- The Nth point to remove. Example: 5.
 
 
-