当前位置: 首页>>代码示例>>C#>>正文


C# Poly2Tri.AdvancingFrontNode类代码示例

本文整理汇总了C#中Poly2Tri.AdvancingFrontNode的典型用法代码示例。如果您正苦于以下问题:C# AdvancingFrontNode类的具体用法?C# AdvancingFrontNode怎么用?C# AdvancingFrontNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AdvancingFrontNode类属于Poly2Tri命名空间,在下文中一共展示了AdvancingFrontNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AdvancingFront

		public AdvancingFront( AdvancingFrontNode head, AdvancingFrontNode tail ) {
			this.Head = head;
			this.Tail = tail;
			this.Search = head;
			AddNode(head);
			AddNode(tail);
		}
开发者ID:CenzyGames,项目名称:Save-your-date-new,代码行数:7,代码来源:AdvancingFront.cs

示例2: FillBasinReq

		/// <summary>
		/// Recursive algorithm to fill a Basin with triangles
		/// </summary>
		private static void FillBasinReq(DTSweepContext tcx, AdvancingFrontNode node)
		{
			if (IsShallow(tcx, node)) return; // if shallow stop filling

			Fill(tcx, node);
			if (node.Prev == tcx.Basin.leftNode && node.Next == tcx.Basin.rightNode)
			{
				return;
			}
			else if (node.Prev == tcx.Basin.leftNode)
			{
				Orientation o = TriangulationUtil.Orient2d(node.Point, node.Next.Point, node.Next.Next.Point);
				if (o == Orientation.CW) return;
				node = node.Next;
			}
			else if (node.Next == tcx.Basin.rightNode)
			{
				Orientation o = TriangulationUtil.Orient2d(node.Point, node.Prev.Point, node.Prev.Prev.Point);
				if (o == Orientation.CCW) return;
				node = node.Prev;
			}
			else
			{
				// Continue with the neighbor node with lowest Y value
				if (node.Prev.Point.Y < node.Next.Point.Y)
				{
					node = node.Prev;
				}
				else
				{
					node = node.Next;
				}
			}
			FillBasinReq(tcx, node);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:38,代码来源:DTSweep.cs

示例3: FillBasin

		/// <summary>
		/// Fills a basin that has formed on the Advancing Front to the right
		/// of given node.<br/>
		/// First we decide a left,bottom and right node that forms the
		/// boundaries of the basin. Then we do a reqursive fill.
		/// </summary>
		/// <param name="tcx"></param>
		/// <param name="node">starting node, this or next node will be left node</param>
		private static void FillBasin(DTSweepContext tcx, AdvancingFrontNode node)
		{
			if (TriangulationUtil.Orient2d(node.Point, node.Next.Point, node.Next.Next.Point) == Orientation.CCW)
			{
				// tcx.basin.leftNode = node.next.next;
				tcx.Basin.leftNode = node;
			}
			else
			{
				tcx.Basin.leftNode = node.Next;
			}

			// Find the bottom and right node
			tcx.Basin.bottomNode = tcx.Basin.leftNode;
			while (tcx.Basin.bottomNode.HasNext && tcx.Basin.bottomNode.Point.Y >= tcx.Basin.bottomNode.Next.Point.Y) tcx.Basin.bottomNode = tcx.Basin.bottomNode.Next;

			if (tcx.Basin.bottomNode == tcx.Basin.leftNode) return; // No valid basin

			tcx.Basin.rightNode = tcx.Basin.bottomNode;
			while (tcx.Basin.rightNode.HasNext && tcx.Basin.rightNode.Point.Y < tcx.Basin.rightNode.Next.Point.Y) tcx.Basin.rightNode = tcx.Basin.rightNode.Next;

			if (tcx.Basin.rightNode == tcx.Basin.bottomNode) return; // No valid basins

			tcx.Basin.width = tcx.Basin.rightNode.Point.X - tcx.Basin.leftNode.Point.X;
			tcx.Basin.leftHighest = tcx.Basin.leftNode.Point.Y > tcx.Basin.rightNode.Point.Y;

			FillBasinReq(tcx, tcx.Basin.bottomNode);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:36,代码来源:DTSweep.cs

示例4: FillAdvancingFront

		/// <summary>
		/// Fills holes in the Advancing Front
		/// </summary>
		private static void FillAdvancingFront(DTSweepContext tcx, AdvancingFrontNode n)
		{
			AdvancingFrontNode node;
			double angle;

			// Fill right holes
			node = n.Next;
			while (node.HasNext)
			{
				angle = HoleAngle(node);
				if (angle > PI_div2 || angle < -PI_div2) break;
				Fill(tcx, node);
				node = node.Next;
			}

			// Fill left holes
			node = n.Prev;
			while (node.HasPrev)
			{
				angle = HoleAngle(node);
				if (angle > PI_div2 || angle < -PI_div2) break;
				Fill(tcx, node);
				node = node.Prev;
			}

			// Fill right basins
			if (n.HasNext && n.Next.HasNext)
			{
				angle = BasinAngle(n);
				if (angle < PI_3div4) FillBasin(tcx, n);
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:35,代码来源:DTSweep.cs

示例5: FillLeftAboveEdgeEvent

		private static void FillLeftAboveEdgeEvent(DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node)
		{
			while (node.Prev.Point.X > edge.P.X)
			{
				if (tcx.IsDebugEnabled) tcx.DTDebugContext.ActiveNode = node;
				// Check if next node is below the edge
				Orientation o1 = TriangulationUtil.Orient2d(edge.Q, node.Prev.Point, edge.P);
				if (o1 == Orientation.CW)
				{
					FillLeftBelowEdgeEvent(tcx, edge, node);
				}
				else
				{
					node = node.Prev;
				}
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:17,代码来源:DTSweep.cs

示例6: FillLeftBelowEdgeEvent

		private static void FillLeftBelowEdgeEvent(DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node)
		{
			if (tcx.IsDebugEnabled) tcx.DTDebugContext.ActiveNode = node;

			if (node.Point.X > edge.P.X)
			{
				if (TriangulationUtil.Orient2d(node.Point, node.Prev.Point, node.Prev.Prev.Point) == Orientation.CW)
				{
					// Concave
					FillLeftConcaveEdgeEvent(tcx, edge, node);
				}
				else
				{
					// Convex
					FillLeftConvexEdgeEvent(tcx, edge, node);
					// Retry this one
					FillLeftBelowEdgeEvent(tcx, edge, node);
				}
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:20,代码来源:DTSweep.cs

示例7: LocatePoint

        /// <summary>
        /// This implementation will use simple node traversal algorithm to find a point on the front
        /// </summary>
        public AdvancingFrontNode LocatePoint(TriangulationPoint point)
        {
            double px = point.X;
            AdvancingFrontNode node = FindSearchNode(px);
            double nx = node.Point.X;

            if (px == nx)
            {
                if (point != node.Point)
                {
                    // We might have two nodes with same x value for a short time
                    if (point == node.Prev.Point)
                    {
                        node = node.Prev;
                    }
                    else if (point == node.Next.Point)
                    {
                        node = node.Next;
                    }
                    else
                    {
                        throw new Exception("Failed to find Node for given afront point");
                    }
                }
            }
            else if (px < nx)
            {
                while ((node = node.Prev) != null)
                {
                    if (point == node.Point)
                    {
                        break;
                    }
                }
            }
            else
            {
                while ((node = node.Next) != null)
                {
                    if (point == node.Point)
                    {
                        break;
                    }
                }
            }
            Search = node;

            return node;
        }
开发者ID:Ayagami,项目名称:Tesis,代码行数:52,代码来源:AdvancingFront.cs

示例8: BasinAngle

		/// <summary>
		/// The basin angle is decided against the horizontal line [1,0]
		/// </summary>
		private static double BasinAngle(AdvancingFrontNode node)
		{
			double ax = node.Point.X - node.Next.Next.Point.X;
			double ay = node.Point.Y - node.Next.Next.Point.Y;
			return Math.Atan2(ay, ax);
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:9,代码来源:DTSweep.cs

示例9: FillEdgeEvent

		private static void FillEdgeEvent(DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node)
		{
			if (tcx.EdgeEvent.Right)
			{
				FillRightAboveEdgeEvent(tcx, edge, node);
			}
			else
			{
				FillLeftAboveEdgeEvent(tcx, edge, node);
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:11,代码来源:DTSweep.cs

示例10: EdgeEvent

		private static void EdgeEvent(DTSweepContext tcx, DTSweepConstraint edge, AdvancingFrontNode node)
		{
			try
			{
				tcx.EdgeEvent.ConstrainedEdge = edge;
				tcx.EdgeEvent.Right = edge.P.X > edge.Q.X;

				if (tcx.IsDebugEnabled) { tcx.DTDebugContext.PrimaryTriangle = node.Triangle; }

				if (IsEdgeSideOfTriangle(node.Triangle, edge.P, edge.Q)) return;

				// For now we will do all needed filling
				// TODO: integrate with flip process might give some better performance
				//       but for now this avoid the issue with cases that needs both flips and fills
				FillEdgeEvent(tcx, edge, node);

				EdgeEvent(tcx, edge.P, edge.Q, node.Triangle, edge.Q);
			}
			catch (PointOnEdgeException)
			{
				//Debug.WriteLine( String.Format( "Warning: Skipping Edge: {0}", e.Message ) );
				throw;
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:24,代码来源:DTSweep.cs

示例11: NewFrontTriangle

		/// <summary>
		/// Creates a new front triangle and legalize it
		/// </summary>
		private static AdvancingFrontNode NewFrontTriangle(DTSweepContext tcx, TriangulationPoint point, AdvancingFrontNode node)
		{
			AdvancingFrontNode newNode;
			DelaunayTriangle triangle;

			triangle = new DelaunayTriangle(point, node.Point, node.Next.Point);
			triangle.MarkNeighbor(node.Triangle);
			tcx.Triangles.Add(triangle);

			newNode = new AdvancingFrontNode(point);
			newNode.Next = node.Next;
			newNode.Prev = node;
			node.Next.Prev = newNode;
			node.Next = newNode;

			tcx.AddNode(newNode); // XXX: BST

			if (tcx.IsDebugEnabled) tcx.DTDebugContext.ActiveNode = newNode;

			if (!Legalize(tcx, triangle)) tcx.MapTriangleToNodes(triangle);

			return newNode;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:26,代码来源:DTSweep.cs

示例12: TurnAdvancingFrontConvex

		/// <summary>
		/// We will traverse the entire advancing front and fill it to form a convex hull.
		/// </summary>
		private static void TurnAdvancingFrontConvex(DTSweepContext tcx, AdvancingFrontNode b, AdvancingFrontNode c)
		{
			AdvancingFrontNode first = b;
			while (c != tcx.Front.Tail)
			{
				if (tcx.IsDebugEnabled) tcx.DTDebugContext.ActiveNode = c;

				if (TriangulationUtil.Orient2d(b.Point, c.Point, c.Next.Point) == Orientation.CCW)
				{
					// [b,c,d] Concave - fill around c
					Fill(tcx, c);
					c = c.Next;
				}
				else
				{
					// [b,c,d] Convex
					if (b != first && TriangulationUtil.Orient2d(b.Prev.Point, b.Point, c.Point) == Orientation.CCW)
					{
						// [a,b,c] Concave - fill around b
						Fill(tcx, b);
						b = b.Prev;
					}
					else
					{
						// [a,b,c] Convex - nothing to fill
						b = c;
						c = c.Next;
					}
				}
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:34,代码来源:DTSweep.cs

示例13: LocateNode

        private AdvancingFrontNode LocateNode(double x)
        {
            AdvancingFrontNode node = FindSearchNode(x);
            if (x < node.Value)
            {
                while ((node = node.Prev) != null)
                {
                    if (x >= node.Value)
                    {
                        Search = node;
                        return node;
                    }
                }
            }
            else
            {
                while ((node = node.Next) != null)
                {
                    if (x < node.Value)
                    {
                        Search = node.Prev;
                        return node.Prev;
                    }
                }
            }

            return null;
        }
开发者ID:Ayagami,项目名称:Tesis,代码行数:28,代码来源:AdvancingFront.cs

示例14: RemoveNode

 public void RemoveNode(AdvancingFrontNode node) { }
开发者ID:Ayagami,项目名称:Tesis,代码行数:1,代码来源:AdvancingFront.cs

示例15: AddNode

 public void AddNode(AdvancingFrontNode node) { }
开发者ID:Ayagami,项目名称:Tesis,代码行数:1,代码来源:AdvancingFront.cs


注:本文中的Poly2Tri.AdvancingFrontNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。