/// <summary> /// Creates a smoothed polyline /// </summary> internal SmoothedPolylineCalculator(IntEdge edgePathPar, Anchor[] anchorsP, GeometryGraph origGraph, SugiyamaLayoutSettings settings, LayerArrays la, ProperLayeredGraph layerGraph, Database databaseP) { this.database = databaseP; edgePath = edgePathPar; anchors = anchorsP; this.layerArrays = la; this.originalGraph = origGraph; this.settings = settings; this.layeredGraph = layerGraph; rightHierarchy = BuildRightHierarchy(); leftHierarchy = BuildLeftHierarchy(); }
private ParallelogramNode BuildLeftHierarchy() { List <Polyline> boundaryAnchorCurves = FindLeftBoundaryAnchorCurves(); List <ParallelogramNode> l = new List <ParallelogramNode>(); foreach (Polyline a in boundaryAnchorCurves) { l.Add(a.ParallelogramNodeOverICurve); } this.thinLeftHierarchy = HierarchyCalculator.Calculate(thinLefttNodes, this.settings.GroupSplit); return(HierarchyCalculator.Calculate(l, this.settings.GroupSplit)); }
private static bool CurveIntersectsHierarchy(LineSegment lineSeg, ParallelogramNode hierarchy) { if (hierarchy == null) { return(false); } if (!Parallelogram.Intersect(lineSeg.ParallelogramNodeOverICurve.Parallelogram, hierarchy.Parallelogram)) { return(false); } ParallelogramBinaryTreeNode n = hierarchy as ParallelogramBinaryTreeNode; if (n != null) { return(CurveIntersectsHierarchy(lineSeg, n.LeftSon) || CurveIntersectsHierarchy(lineSeg, n.RightSon)); } return(Curve.CurveCurveIntersectionOne(lineSeg, ((ParallelogramNodeOverICurve)hierarchy).Seg, false) != null); }
private bool BezierSegIntersectsTree(CubicBezierSegment seg, ParallelogramNode tree) { if (tree == null) { return(false); } if (Parallelogram.Intersect(seg.ParallelogramNodeOverICurve.Parallelogram, tree.Parallelogram)) { ParallelogramBinaryTreeNode n = tree as ParallelogramBinaryTreeNode; if (n != null) { return(BezierSegIntersectsTree(seg, n.LeftSon) || BezierSegIntersectsTree(seg, n.RightSon)); } else { return(BezierSegIntersectsBoundary(seg, ((ParallelogramNodeOverICurve)tree).Seg)); } } else { return(false); } }
static bool SegIntersectsBound(Site a, Site b, ParallelogramNode hierarchy) { return(CurveIntersectsHierarchy(new LineSegment(a.Point, b.Point), hierarchy)); }