public override void Prepare(TriangulationContext tcx) { base.Prepare(tcx); for (int i = 0; i < EdgeIndex.Length; i += 2) { // XXX: must change!! tcx.MakeNewConstraint(Points[EdgeIndex[i]], Points[EdgeIndex[i + 1]]); } }
/// <summary> /// Creates constraints and populates the context with points /// </summary> /// <param name="tcx">The context</param> public void Prepare(TriangulationContext tcx) { if (_triangles == null) { _triangles = new List<DelaunayTriangle>(_points.Length); } else { _triangles.Clear(); } // Outer constraints int j = _points.Length; for (int i = 0; i < j - 1; i++) { tcx.MakeNewConstraint(_points[i], _points[i + 1]); } tcx.MakeNewConstraint(_points[0], _points[j - 1]); tcx.Points.AddRange(_points); // Hole constraints if (_holes != null) { for (int h = 0; h < _holes.Length; ++h) { Polygon p = _holes[h]; int p_npoints_lim = p._points.Length - 1; for (int i = 0; i < p_npoints_lim; ++i) { tcx.MakeNewConstraint(p._points[i], p._points[i + 1]); } tcx.MakeNewConstraint(p._points[0], p._points[p_npoints_lim]); tcx.Points.AddRange(p._points); } } //if (_steinerPoints != null) //{ // tcx.Points.AddRange(_steinerPoints); //} }