예제 #1
0
 public virtual void Prepare(TriangulationContext tcx)
 {
     if (Triangles == null)
     {
         Triangles = new List <DelaunayTriangle> (Points.Count);
     }
     else
     {
         Triangles.Clear();
     }
     tcx.Points.AddRange(Points);
 }
        public override void Prepare(TriangulationContext tcx)
        {
            if (!Initialize())
            {
                return;
            }

            base.Prepare(tcx);

            Dictionary <uint, TriangulationConstraint> .Enumerator it = mConstraintMap.GetEnumerator();
            while (it.MoveNext())
            {
                TriangulationConstraint tc = it.Current.Value;
                tcx.NewConstraint(tc.P, tc.Q);
            }
        }
예제 #3
0
        /// <summary>
        /// Creates constraints and populates the context with points
        /// </summary>
        /// <param name="tcx">The context</param>
        public void Prepare(TriangulationContext tcx)
        {
            if (mTriangles == null)
            {
                mTriangles = new List <DelaunayTriangle> (mPoints.Count);
            }
            else
            {
                mTriangles.Clear();
            }

            // Outer constraints
            for (int i = 0; i < mPoints.Count - 1; i++)
            {
                //tcx.NewConstraint(mPoints[i], mPoints[i + 1]);
                tcx.NewConstraint(this [i], this [i + 1]);
            }
            tcx.NewConstraint(this [Count - 1], this [0]);              // Changed by Kronnect Games
//			tcx.NewConstraint (this [0], this [Count - 1]);

            tcx.Points.AddRange(this);

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

            if (mSteinerPoints != null)
            {
                tcx.Points.AddRange(mSteinerPoints);
            }
        }
예제 #4
0
 public void Prepare(TriangulationContext tcx)
 {
     throw new NotImplementedException("PolyHole.Prepare should never get called");
 }