public static int LengthComparison(EdgeNode a, EdgeNode b) { float aLength = a.Length; float bLength = b.Length; if (Mathf.Approximately(aLength, bLength)) { return(0); } else if (aLength > bLength) { return(1); } else { return(-1); } }
public void DetermineHallway() { var hallWayThickness = this.config.hallWayThickness; this.hallWayRects = new List <Rect>(); this.jointRects = new List <Rect>(); foreach (var edge in this.treeEdgeNodes) { var aRect = edge.a.rect; var bRect = edge.b.rect; var intersectionPoint = edge.FindRectanularIntersection(); var joint = new Rect(intersectionPoint.x - hallWayThickness / 2, intersectionPoint.y - hallWayThickness / 2, hallWayThickness, hallWayThickness); var aHallway = EdgeNode.RectBetweemTwoRects(aRect, joint, hallWayThickness); var bHallway = EdgeNode.RectBetweemTwoRects(bRect, joint, hallWayThickness); this.jointRects.Add(joint); this.hallWayRects.Add(aHallway); this.hallWayRects.Add(bHallway); } }