public virtual void AddPolyPoint(float x, float y) { TriangleBasic.Point p = new TriangleBasic.Point(x, y); if (!poly.Contains(p)) { poly.Add(p); } }
private bool Process(TriangleBasic.PointList contour, TriangleBasic.PointList result) { result.Clear(); int n = contour.Size(); if (n < 3) { return(false); } int[] sV = new int[n]; if (0.0f < Area(contour)) { for (int v = 0; v < n; v++) { sV[v] = v; } } else { for (int v_0 = 0; v_0 < n; v_0++) { sV[v_0] = (n - 1) - v_0; } } int nv = n; int count = 2 * nv; for (int v_1 = nv - 1; nv > 2;) { if (0 >= (count--)) { return(false); } int u = v_1; if (nv <= u) { u = 0; } v_1 = u + 1; if (nv <= v_1) { v_1 = 0; } int w = v_1 + 1; if (nv <= w) { w = 0; } if (Snip(contour, u, v_1, w, nv, sV)) { int a, b, c, s, t; a = sV[u]; b = sV[v_1]; c = sV[w]; result.Add(contour.Get(a)); result.Add(contour.Get(b)); result.Add(contour.Get(c)); for (s = v_1, t = v_1 + 1; t < nv; s++, t++) { sV[s] = sV[t]; } nv--; count = 2 * nv; } } return(true); }