circled in part

This commit is contained in:
nik gaffney 2006-11-13 21:50:58 +01:00
parent be217c70fb
commit 92422369dc
2 changed files with 26 additions and 19 deletions

View file

@ -192,29 +192,36 @@
(define twopi (* 2 pi)) (define twopi (* 2 pi))
(define (shadowpi-tree node pb x y r)
(define (shadowpi-tree node pb x y t1 t2 r)
;; node from whcih to draw the layout, centred at x,y on the containment arc
;; given by t1->t2 with radius, r
(let* ([parents (reverse (send node get-parents))] (let* ([parents (reverse (send node get-parents))]
[n (length parents)] [n (length parents)]
[xi (snip-x node)] [xi (snip-x node)]
[yi (snip-y node)] [yi (snip-y node)]
(phi 0.85)) (phi 0.75))
;; distribute parents of given node evenly along a containment circle ;; distribute parents of given node evenly along a containment circle
;; centered on the node. ;; centered on the node.
(dotimes (i n) (dotimes (i n)
(let ((parent (list-ref parents i)) (let ((parent (list-ref parents i))
(x1 (* r (cos (* (/ 1 pi) (x1 (* r (cos (* (* (+ t1 (- t2 t1)) (/ i n))))))
(- (/ n 2) (+ 1 i)))))) (y1 (* r (sin (* (* (+ t1 (- t2 t1)) (/ i n)))))))
(y1 (* r (sin (* (/ 1 pi)
(- (/ n 2) (+ 1 i)))))))
(send pb move-to parent (send pb move-to parent
(+ xi x1) (+ yi y1)) (+ xi x1) (+ yi y1))
;; draw circles around the nodes parents and evenly distribute their ;; draw circles around the nodes parents and evenly distribute their
;; parents along containment arcs. ;; parents along containment arcs.
(shadowpi-tree parent pb (+ xi x1) (+ yi y1) (* r phi)) (shadowpi-tree parent pb
(+ xi x1) (+ yi y1) ;; centred on
(atan (/ (- y1 yi) (- x1 xi)))
(+ pi (atan (/ (- y1 yi) (- x1 xi))))
(* r phi)) ;; radius
;; this proceeds recursively, so that successively distant descendants of ;; this proceeds recursively, so that successively distant descendants of
;; the goven node are positioned on successively smaller containment arcs. ;; the goven node are positioned on successively smaller containment arcs.

View file

@ -118,7 +118,7 @@
[(#\z) ;; C-z re.colour [(#\z) ;; C-z re.colour
(colour-tree selected-snip p)] (colour-tree selected-snip p)]
[(#\x) ;; C-x re.lapse [(#\x) ;; C-x re.lapse
(shadowpi-tree selected-snip p 0 0 120)] (shadowpi-tree selected-snip p 0 0 0 (* 2 pi) 120)]
[(#\=) ;; C-= zoom->out [(#\=) ;; C-= zoom->out
(send p zoom 1.1)] (send p zoom 1.1)]
[(#\-) ;; C-- zoom->in [(#\-) ;; C-- zoom->in