C# Class FarseerPhysics.Common.PolygonManipulation.YuPengClipper

ファイルを表示 Open project: prime31/Nez

Public Methods

Method Description
difference ( Vertices polygon1, Vertices polygon2, PolyClipError &error ) : List
intersect ( Vertices polygon1, Vertices polygon2, PolyClipError &error ) : List
union ( Vertices polygon1, Vertices polygon2, PolyClipError &error ) : List

Private Methods

Method Description
buildPolygonsFromChain ( List simplicies, List &result ) : PolyClipError

Calculates the polygon(s) from the result simplical chain.

Used by method Execute().

calculateBeta ( Vector2 point, Edge e, float coefficient ) : float

Needed to calculate the characteristics function of a simplex.

Used by method CalculateEdgeCharacter().

calculateIntersections ( Vertices polygon1, Vertices polygon2, Vertices &slicedPoly1, Vertices &slicedPoly2 ) : void

Calculates all intersections between two polygons.

calculateResultChain ( List poly1Coeff, List poly1Simplicies, List poly2Coeff, List poly2Simplicies, PolyClipType clipType, List &resultSimplices ) : void

Calculates the characteristics function for all edges of the given simplical chains and builds the result chain.

Used by method Execute().

calculateSimplexCoefficient ( Vector2 a, Vector2 b, Vector2 c ) : float

Returns the coefficient of a simplex.

Used by method CalculateSimplicalChain().

calculateSimplicalChain ( Vertices poly, List &coeff, List &simplicies ) : void

Calculates the simplical chain corresponding to the input polygon.

Used by method Execute().

execute ( Vertices subject, Vertices clip, PolyClipType clipType, PolyClipError &error ) : List

Implements "A new algorithm for Boolean operations on general polygons" available here: http://liama.ia.ac.cn/wiki/_media/user:dong:dong_cg_05.pdf Merges two polygons, a subject and a clip with the specified operation. Polygons may not be self-intersecting. Warning: May yield incorrect results or even crash if polygons contain collinear points.

getAlpha ( Vector2 start, Vector2 end, Vector2 point ) : float

Needed for sorting multiple intersections points on the same edge.

Used by method CalculateIntersections().

pointInSimplex ( Vector2 point, Edge edge ) : bool

Winding number test for a point in a simplex.

pointOnLineSegment ( Vector2 start, Vector2 end, Vector2 point ) : bool

Tests if a point lies on a line segment.

Used by method CalculateBeta().

vectorEqual ( Vector2 vec1, Vector2 vec2 ) : bool

Method Details

difference() public static method

public static difference ( Vertices polygon1, Vertices polygon2, PolyClipError &error ) : List
polygon1 Vertices
polygon2 Vertices
error PolyClipError
return List

intersect() public static method

public static intersect ( Vertices polygon1, Vertices polygon2, PolyClipError &error ) : List
polygon1 Vertices
polygon2 Vertices
error PolyClipError
return List

union() public static method

public static union ( Vertices polygon1, Vertices polygon2, PolyClipError &error ) : List
polygon1 Vertices
polygon2 Vertices
error PolyClipError
return List