Ctrl+K

SimplifyTools

Declaration

public static class tainicom.Aether.Physics2D.Common.PolygonManipulation.SimplifyTools

Provides a set of tools to simplify polygons in various ways.

Methods

CollinearSimplify static

Removes all collinear points on the polygon.

Vertices CollinearSimplify(Vertices vertices, float collinearityTolerance = 0)

Parameters:

Name Type Description
vertices tainicom.Aether.Physics2D.Common.Vertices The polygon that needs simplification.
collinearityTolerance System.Single = 0 The collinearity tolerance.

Returns: A simplified polygon.

DouglasPeuckerSimplify static

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.

Vertices DouglasPeuckerSimplify(Vertices vertices, float distanceTolerance)

Parameters:

Name Type Description
vertices tainicom.Aether.Physics2D.Common.Vertices
distanceTolerance System.Single

Returns: The simplified polygon

MergeParallelEdges static

Merges all parallel edges in the list of vertices

Vertices MergeParallelEdges(Vertices vertices, float tolerance)

Parameters:

Name Type Description
vertices tainicom.Aether.Physics2D.Common.Vertices The vertices.
tolerance System.Single The tolerance.

MergeIdenticalPoints static

Merges the identical points in the polygon.

Vertices MergeIdenticalPoints(Vertices vertices)

Parameters:

Name Type Description
vertices tainicom.Aether.Physics2D.Common.Vertices The vertices.

ReduceByDistance static

Reduces the polygon by distance.

Vertices ReduceByDistance(Vertices vertices, float distance)

Parameters:

Name Type Description
vertices tainicom.Aether.Physics2D.Common.Vertices The vertices.
distance System.Single The distance between points. Points closer than this will be removed.

ReduceByNth static

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

Vertices ReduceByNth(Vertices vertices, int nth)

Parameters:

Name Type Description
vertices tainicom.Aether.Physics2D.Common.Vertices The vertices.
nth System.Int32 The Nth point to remove. Example: 5.

ReduceByArea static

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.

Vertices ReduceByArea(Vertices vertices, float areaTolerance)

Parameters:

Name Type Description
vertices tainicom.Aether.Physics2D.Common.Vertices
areaTolerance System.Single