C# Class FarseerPhysics.Common.PolygonManipulation.SimplifyTools

Provides a set of tools to simplify polygons in various ways.
Mostrar archivo Open project: prime31/Nez Class Usage Examples

Public Methods

Method Description
collinearSimplify ( Vertices vertices, float collinearityTolerance ) : Vertices

Removes all collinear points on the polygon.

douglasPeuckerSimplify ( Vertices vertices, float distanceTolerance ) : Vertices

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.

mergeIdenticalPoints ( Vertices vertices ) : Vertices

Merges the identical points in the polygon.

mergeParallelEdges ( Vertices vertices, float tolerance ) : Vertices

Merges all parallel edges in the list of vertices

reduceByArea ( Vertices vertices, float areaTolerance ) : Vertices

Simplify the polygon by removing all points that in pairs of 3 have an area less than the tolerance. Pass in 0 as tolerance, and it will only remove collinear points.

reduceByDistance ( Vertices vertices, float distance ) : Vertices

Reduces the polygon by distance.

reduceByNth ( Vertices vertices, int nth ) : Vertices

Reduces the polygon by removing the Nth vertex in the vertices list.

Private Methods

Method Description
simplifySection ( Vertices vertices, int i, int j, bool usePoint, float distanceTolerance ) : void

Method Details

collinearSimplify() public static method

Removes all collinear points on the polygon.
public static collinearSimplify ( Vertices vertices, float collinearityTolerance ) : Vertices
vertices Vertices The polygon that needs simplification.
collinearityTolerance float The collinearity tolerance.
return Vertices

douglasPeuckerSimplify() public static method

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.
public static douglasPeuckerSimplify ( Vertices vertices, float distanceTolerance ) : Vertices
vertices Vertices
distanceTolerance float
return Vertices

mergeIdenticalPoints() public static method

Merges the identical points in the polygon.
public static mergeIdenticalPoints ( Vertices vertices ) : Vertices
vertices Vertices The vertices.
return Vertices

mergeParallelEdges() public static method

Merges all parallel edges in the list of vertices
public static mergeParallelEdges ( Vertices vertices, float tolerance ) : Vertices
vertices Vertices The vertices.
tolerance float The tolerance.
return Vertices

reduceByArea() public static method

Simplify the polygon by removing all points that in pairs of 3 have an area less than the tolerance. Pass in 0 as tolerance, and it will only remove collinear points.
public static reduceByArea ( Vertices vertices, float areaTolerance ) : Vertices
vertices Vertices
areaTolerance float
return Vertices

reduceByDistance() public static method

Reduces the polygon by distance.
public static reduceByDistance ( Vertices vertices, float distance ) : Vertices
vertices Vertices The vertices.
distance float The distance between points. Points closer than this will be removed.
return Vertices

reduceByNth() public static method

Reduces the polygon by removing the Nth vertex in the vertices list.
public static reduceByNth ( Vertices vertices, int nth ) : Vertices
vertices Vertices The vertices.
nth int The Nth point to remove. Example: 5.
return Vertices