internal static void RecordChordCut(RectEdge rectEdge) { #if debug string chordNote = "CHORDEDGE:"; chordNote += rectEdge.FirstPosition.xPos + "," + rectEdge.FirstPosition.yPos + "|"; chordNote += rectEdge.SecondPosition.xPos + "," + rectEdge.SecondPosition.yPos + "|"; StringLog.Add(chordNote); #endif }
public bool Equals(RectEdge r) { // If parameter is null return false: if (r == null) { return(false); } // Return true if the fields match: return(FirstPosition.Equals(r.FirstPosition) && (SecondPosition.Equals(r.SecondPosition)) && EdgeType == r.EdgeType); }
public RectifyRectangle(RectShape shape, bool validateRectangle = true) { if (validateRectangle) { if (shape.Vertices.Count != 4) { throw new Exception("Rectangle w/o exactly 4 vertices"); } RectEdge startEdge = shape.Perimeter.First(); RectEdge endEdge = startEdge; for (int i = 0; i < shape.Perimeter.Count; i++) { endEdge = endEdge.Next; } if (startEdge != endEdge) { throw new Exception("Rectangle w/o contiguous perimeter"); } } this.PathGroup = shape.PathGroup; //get the defining positions from the verts //temporary assignment topRight = shape.Vertices.First().VertPosition; bottomLeft = topRight; for (int i = 1; i < 4; i++) { if (shape.Vertices[i].VertPosition.xPos < bottomLeft.xPos || shape.Vertices[i].VertPosition.yPos < bottomLeft.yPos) { bottomLeft = shape.Vertices[i].VertPosition; } if (shape.Vertices[i].VertPosition.xPos > topRight.xPos || shape.Vertices[i].VertPosition.yPos > topRight.yPos) { topRight = shape.Vertices[i].VertPosition; } } //instantiate the edgearrays //get all the edges w/ firstPosition x == topLeft.x && secondPosition x == topLeft.x LeftEdge = new RectNeighbor[this.Height]; var workingEdges = shape.Perimeter.FindAll(e => e.HeadingDirection == Direction.North).OrderBy(e => e.SecondPosition.yPos).ToArray(); for (int i = 0; i < workingEdges.Count(); i++) { LeftEdge[i] = new RectNeighbor(null, workingEdges[i].EdgeType); } RightEdge = new RectNeighbor[this.Height]; workingEdges = shape.Perimeter.FindAll(e => e.HeadingDirection == Direction.South).OrderBy(e => e.FirstPosition.yPos).ToArray(); for (int i = 0; i < workingEdges.Count(); i++) { RightEdge[i] = new RectNeighbor(null, workingEdges[i].EdgeType); } //get all the edges w/ firstPosition y == topLeft.y && secondPosition y == topLeft.y TopEdge = new RectNeighbor[this.Width]; workingEdges = shape.Perimeter.FindAll(e => e.HeadingDirection == Direction.East).OrderBy(e => e.SecondPosition.xPos).ToArray(); for (int i = 0; i < workingEdges.Count(); i++) { TopEdge[i] = new RectNeighbor(null, workingEdges[i].EdgeType); } BottomEdge = new RectNeighbor[this.Width]; workingEdges = shape.Perimeter.FindAll(e => e.HeadingDirection == Direction.West).OrderBy(e => e.FirstPosition.xPos).ToArray(); for (int i = 0; i < workingEdges.Count(); i++) { BottomEdge[i] = new RectNeighbor(null, workingEdges[i].EdgeType); } }
public RectFlowNode(RectEdge edge, FlowType ftype) { this.Edge = edge; this.FlowType = ftype; DestinationNodes = new HashSet <RectFlowNode>(); }
public RectEdgeEdge(RectEdge first, RectEdge second, bool isInMatching) { FirstEdge = first; SecondEdge = second; IsInMatching = isInMatching; }