示例#1
0
 public virtual void PrepareTriangulation(TriangulationContext tcx)
 {
     if (Triangles == null)
     {
         Triangles = new List <DelaunayTriangle>(Points.Count);
     }
     else
     {
         Triangles.Clear();
     }
     tcx.Points.AddRange(Points);
 }
示例#2
0
        public virtual void PrepareTriangulation(TriangulationContext tcx)
        {
            bool flag = this.Triangles == null;

            if (flag)
            {
                this.Triangles = new List <DelaunayTriangle>(this.Points.Count);
            }
            else
            {
                this.Triangles.Clear();
            }
            tcx.Points.AddRange(this.Points);
        }
示例#3
0
        public void PrepareTriangulation(TriangulationContext tcx)
        {
            bool flag = this._triangles == null;

            if (flag)
            {
                this._triangles = new List <DelaunayTriangle>(this._points.Count);
            }
            else
            {
                this._triangles.Clear();
            }
            for (int i = 0; i < this._points.Count - 1; i++)
            {
                tcx.NewConstraint(this._points[i], this._points[i + 1]);
            }
            tcx.NewConstraint(this._points[0], this._points[this._points.Count - 1]);
            tcx.Points.AddRange(this._points);
            bool flag2 = this._holes != null;

            if (flag2)
            {
                foreach (Polygon current in this._holes)
                {
                    for (int j = 0; j < current._points.Count - 1; j++)
                    {
                        tcx.NewConstraint(current._points[j], current._points[j + 1]);
                    }
                    tcx.NewConstraint(current._points[0], current._points[current._points.Count - 1]);
                    tcx.Points.AddRange(current._points);
                }
            }
            bool flag3 = this._steinerPoints != null;

            if (flag3)
            {
                tcx.Points.AddRange(this._steinerPoints);
            }
        }
示例#4
0
        /// <summary>
        /// Creates constraints and populates the context with points
        /// </summary>
        /// <param name="tcx">The context</param>
        public void PrepareTriangulation(TriangulationContext tcx)
        {
            if (_triangles == null)
            {
                _triangles = new List <DelaunayTriangle>(_points.Count);
            }
            else
            {
                _triangles.Clear();
            }

            // Outer constraints
            for (int i = 0; i < _points.Count - 1; i++)
            {
                tcx.NewConstraint(_points[i], _points[i + 1]);
            }
            tcx.NewConstraint(_points[0], _points[_points.Count - 1]);
            tcx.Points.AddRange(_points);

            // Hole constraints
            if (_holes != null)
            {
                foreach (Polygon p in _holes)
                {
                    for (int i = 0; i < p._points.Count - 1; i++)
                    {
                        tcx.NewConstraint(p._points[i], p._points[i + 1]);
                    }
                    tcx.NewConstraint(p._points[0], p._points[p._points.Count - 1]);
                    tcx.Points.AddRange(p._points);
                }
            }

            if (_steinerPoints != null)
            {
                tcx.Points.AddRange(_steinerPoints);
            }
        }
示例#5
0
 public override void PrepareTriangulation(TriangulationContext tcx)
 {
     base.PrepareTriangulation(tcx);
     if (_constrainedPointList != null)
     {
         TriangulationPoint p1, p2;
         List <TriangulationPoint> .Enumerator iterator = _constrainedPointList.GetEnumerator();
         while (iterator.MoveNext())
         {
             p1 = iterator.Current;
             iterator.MoveNext();
             p2 = iterator.Current;
             tcx.NewConstraint(p1, p2);
         }
     }
     else
     {
         for (int i = 0; i < EdgeIndex.Length; i += 2)
         {
             // XXX: must change!!
             tcx.NewConstraint(Points[EdgeIndex[i]], Points[EdgeIndex[i + 1]]);
         }
     }
 }
示例#6
0
        public override void PrepareTriangulation(TriangulationContext tcx)
        {
            base.PrepareTriangulation(tcx);
            bool flag = this._constrainedPointList != null;

            if (flag)
            {
                List <TriangulationPoint> .Enumerator enumerator = this._constrainedPointList.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    TriangulationPoint current = enumerator.Current;
                    enumerator.MoveNext();
                    TriangulationPoint current2 = enumerator.Current;
                    tcx.NewConstraint(current, current2);
                }
            }
            else
            {
                for (int i = 0; i < this.EdgeIndex.Length; i += 2)
                {
                    tcx.NewConstraint(base.Points[this.EdgeIndex[i]], base.Points[this.EdgeIndex[i + 1]]);
                }
            }
        }