Nicely curved, non-overlapping links in graph view
Have links in the graph view drawn with nice curves so that they don't overlap.
Blueprint information
- Status:
- Not started
- Approver:
- None
- Priority:
- Low
- Drafter:
- Alex Mitchell
- Direction:
- Needs approval
- Assignee:
- Benedict Lee
- Definition:
- Approved
- Series goal:
- Accepted for 2.3-experimental
- Implementation:
- Unknown
- Milestone target:
- 2.3-experimental-1
- Started by
- Completed by
Related branches
Related bugs
Sprints
Whiteboard
To prevent excessive iterating of the nodes, we define the concept of an edge group. An edge group is the list of links between 2 nodes A and B, where A and B may be the same node, leading to loops.
To build the edge groups:
For each node:
Get the list of links from this node to all later (in the list position) nodes
From each later node
Get the list of links from the later node to this node
Merge this list with the earlier list
This is not a particularly efficient algorithm; a rough time bound is approcimately O(n^2), so it will probably choke on large inputs.
Loop drawing function:
(define (draw-loop pt edge-grp-index)
(let* ((m (+ 1 (* edge-grp-index 0.2)))
(s (/ (+ (get node-size x) (get node-size y)) 2))
(d (+ (* (/ s 2) m) (* 4 s m))))
(draw-
Curve drawing algorithm:
(define (draw-curved-edge src tgt edge-grp-index edge-grp)
(let* ((vx (- (car tgt) (car src)))
(vy (- (cdr tgt) (cdr src)))
(vx2 (* vy 0.6))
(vy2 (* (- vx) 0.6))
(gap 0.2)
(ox 0.0)
(oy 0.0)
(f (quotient (+ 1 edge-grp-index) 2)))
(set! vx (* vx 0.2))
(set! vy (* vy 0.2))
(define main (get edge-grp 0))
(define edge (get edge-grp edge-grp-index))
(if