/* <summary> * // Subclasses can call this method to add a triangle to the end of the queue. This is useful for * // initializing the queue to a chosen set of triangles. * // </summary> * // <param name="tri">a triangle</param> * /* * protected void addLast(QuadEdgeTriangle tri) { triQueue.addLast(tri); } */ /// <summary> /// Subclasses call this method to perform the visiting process. /// </summary> public void VisitAll(ITraversalVisitor visitor) { while (_triQueue.Count > 0) { QuadEdgeTriangle tri = _triQueue.First.Value; _triQueue.RemoveFirst(); Process(tri, visitor); } }
/// <summary> /// Gets the neighbours of this triangle. If there is no neighbour triangle, the array element is /// <code>null</code> /// </summary> /// <returns>an array containing the 3 neighbours of this triangle</returns> public QuadEdgeTriangle[] GetNeighbours() { var neigh = new QuadEdgeTriangle[3]; for (int i = 0; i < 3; i++) { neigh[i] = (QuadEdgeTriangle)GetEdge(i).Sym.Data; } return(neigh); }
private void Process(QuadEdgeTriangle currTri, ITraversalVisitor visitor) { currTri.GetNeighbours(); for (int i = 0; i < 3; i++) { QuadEdgeTriangle neighTri = (QuadEdgeTriangle)currTri.GetEdge(i).Sym.Data; if (neighTri == null) { continue; } if (visitor.Visit(currTri, i, neighTri)) { _triQueue.AddLast(neighTri); } } }
public void Init(QuadEdgeTriangle tri) { _triQueue.AddLast(tri); }