I wonder how work for Graham scan algorithm, so I try to trace the C# code. Before doing Graham scan algorithm, we should sorting all points. My question is how to sorting?
Check the following code, (P.S. In CCT.NUI.Core.Shape.GrahamScan.cs)
private IList<Point> SortPointsByAngle()
var p0 = this.FindMinimalOrdinatePoint();
var comparer = new PointAngleComparer2D(p0);
var sortedPoints = new List<Point>(this.points);
sortedPoints.Sort(1, sortedPoints.Count - 1, comparer);
the red line, I know sorting from point 1 to Count-1 and use comparer sorting. In class PointAngleComparer2D, I can found the comparing method (means comparer).From document (http://msdn.microsoft.com/en-us/library/8ce6t5ad.aspx),
it's also tell me it's binary search.
But, I don't know the detail about how to getting the two points (by binary search? how to select the two point? ) and compare (by comparer?) sorting and then get the final result. Does somebody tell me the detail? Or tell me where to get
the detail information. Thanks!