// Partition a x-monotone mountain into triangles O(n) // See "Computational Geometry in C", 2nd edition, by Joseph O'Rourke, page 52 public void Process() { // Establish the proper sign _positive = AngleSign(); // create monotone polygon - for dubug purposes GenMonoPoly(); // Initialize internal angles at each nonbase vertex // Link strictly convex vertices into a list, ignore reflex vertices Point p = _head.Next; while (p.Neq(_tail)) { float a = Angle(p); // If the point is almost colinear with it's neighbor, remove it! if (a >= PiSlop || a <= -PiSlop || a == 0.0f) { Remove(p); } else if (IsConvex(p)) { _convexPoints.Add(p); } p = p.Next; } Triangulate(); }
private bool Valid(Point p) { return(p.Neq(_head) && p.Neq(_tail) && IsConvex(p)); }
private bool Valid(Point p) { return p.Neq(_head) && p.Neq(_tail) && IsConvex(p); }