public override void Prepare(TriangulationContext tcx) {
			base.Prepare(tcx);
			for (int i = 0; i < EdgeIndex.Length; i += 2) {
				// XXX: must change!!
				tcx.NewConstraint(Points[EdgeIndex[i]], Points[EdgeIndex[i + 1]]);
			}
		}
		public virtual void Prepare(TriangulationContext tcx) {
			if (Triangles == null) {
				Triangles = new List<DelaunayTriangle>(Points.Count);
			} else {
				Triangles.Clear();
			}
			tcx.Points.AddRange(Points);
		}
Beispiel #3
0
 public virtual void Prepare(TriangulationContext tcx)
 {
     if (Triangles == null)
     {
         Triangles = new List <DelaunayTriangle>(Points.Count);
     }
     else
     {
         Triangles.Clear();
     }
     tcx.Points.AddRange(Points);
 }
Beispiel #4
0
 public virtual void prepareTriangulation(TriangulationContext tcx)
 {
     if (_triangles == null)
     {
         _triangles = new List <DelaunayTriangle>(_points.Count);
     }
     else
     {
         _triangles.Clear();
     }
     tcx.addPoints(_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);
            }
        }
Beispiel #6
0
        /// <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);
            //}
        }
Beispiel #7
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]);              // TODO: 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]);                      // TODO: Changed by Kronnect Games
//					tcx.NewConstraint (p [0], p [p.Count - 1]);
                    tcx.Points.AddRange(p);
                }
            }

            if (mSteinerPoints != null)
            {
                tcx.Points.AddRange(mSteinerPoints);
            }
        }
Beispiel #8
0
        /// <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.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);
            }
        }
Beispiel #9
0
 public static void Triangulate(TriangulationContext tcx)
 {
     switch (tcx.Algorithm)
     {
         case TriangulationAlgorithm.DTSweep:
         default:
             DTSweep.Triangulate((DTSweepContext)tcx);
             break;
     }
 }
Beispiel #10
0
		/// <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.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);
			}
		}
        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);
            }
        }
Beispiel #12
0
 public void Prepare(TriangulationContext tcx)
 {
     throw new NotImplementedException("PolyHole.Prepare should never get called");
 }