C# Class Project290.Physics.Common.PolygonManipulation.SimplifyTools

Datei anzeigen Open project: scastle/Solitude

Public Methods

Method Description
CollinearSimplify ( Vertices vertices ) : Vertices

Removes all collinear points on the polygon. Has a default bias of 0

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 ) : void

Merges all parallel edges in the list of vertices

ReduceByArea ( Vertices vertices, float areaTolerance ) : Vertices
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
DistancePointLine ( Vector2 p, Vector2 A, Vector2 B ) : double
DistancePointPoint ( Vector2 p, Vector2 p2 ) : double
SimplifySection ( Vertices vertices, int i, int j ) : void

Method Details

CollinearSimplify() public static method

Removes all collinear points on the polygon. Has a default bias of 0
public static CollinearSimplify ( Vertices vertices ) : Vertices
vertices Vertices The polygon that needs simplification.
return Vertices

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 ) : void
vertices Vertices The vertices.
tolerance float The tolerance.
return void

ReduceByArea() public static method

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 'joined'.
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