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

@ -191,35 +191,42 @@
;;;;; ; ;;; ; ;
(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))]
[n (length parents)]
[xi (snip-x node)]
[yi (snip-y node)]
(phi 0.85))
(phi 0.75))
;; distribute parents of given node evenly along a containment circle
;; centered on the node.
;; distribute parents of given node evenly along a containment circle
;; centered on the node.
(dotimes (i n)
(let ((parent (list-ref parents i))
(x1 (* r (cos (* (/ 1 pi)
(- (/ n 2) (+ 1 i))))))
(y1 (* r (sin (* (/ 1 pi)
(- (/ n 2) (+ 1 i)))))))
(send pb move-to parent
(+ xi x1) (+ yi y1))
(dotimes (i n)
(let ((parent (list-ref parents i))
(x1 (* r (cos (* (* (+ t1 (- t2 t1)) (/ i n))))))
(y1 (* r (sin (* (* (+ t1 (- t2 t1)) (/ i n)))))))
(send pb move-to parent
(+ xi x1) (+ yi y1))
;; draw circles around the nodes parents and evenly distribute their
;; parents along containment arcs.
;; draw circles around the nodes parents and evenly distribute their
;; 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
;; the goven node are positioned on successively smaller containment arcs.
;; this proceeds recursively, so that successively distant descendants of
;; the goven node are positioned on successively smaller containment arcs.
))))
))))
) ;; end of module

View file

@ -118,7 +118,7 @@
[(#\z) ;; C-z re.colour
(colour-tree selected-snip p)]
[(#\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
(send p zoom 1.1)]
[(#\-) ;; C-- zoom->in