C# Class Core2D.Math.ConvexHull.MonotoneChain

Implementation of Andrew's monotone chain 2D convex hull algorithm.
http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain Asymptotic complexity O(n log n).
Show file Open project: Core2D/Core2D

Public Methods

Method Description
ConvexHull ( System.Vector2 vertices, System.Vector2 &hull, int &k ) : void

Returns a list of vertices's on the convex hull in counter-clockwise order.

The last vertice in the returned list is the same as the first one.

Cross ( System.Vector2 p1, System.Vector2 p2, System.Vector2 p3 ) : double

2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product. Returns a positive value, if OAB makes a counter-clockwise turn, negative for clockwise turn, and zero if the vertices's are collinear.

Method Details

ConvexHull() public method

Returns a list of vertices's on the convex hull in counter-clockwise order.
The last vertice in the returned list is the same as the first one.
public ConvexHull ( System.Vector2 vertices, System.Vector2 &hull, int &k ) : void
vertices System.Vector2 The raw vertices array.
hull System.Vector2 The output hull vertices array.
k int The number of output hull vertices.
return void

Cross() public method

2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product. Returns a positive value, if OAB makes a counter-clockwise turn, negative for clockwise turn, and zero if the vertices's are collinear.
public Cross ( System.Vector2 p1, System.Vector2 p2, System.Vector2 p3 ) : double
p1 System.Vector2
p2 System.Vector2
p3 System.Vector2
return double