several onion skin thin slices, each thinner than the last.. .
This commit is contained in:
nik gaffney 2006-12-03 00:27:43 +01:00
parent 23ab92bdf7
commit 5b2e5ad26e
3 changed files with 17 additions and 35 deletions

View file

@ -1,6 +1,6 @@
;; -*- mode: scheme -*- ;; -*- mode: scheme -*-
;; ;;
;; basic layout attmepts ;; basic layout attempts
;; ;;
;; copyright (C) 2004 FoAM vzw ;; copyright (C) 2004 FoAM vzw
;; You are granted the rights to distribute and use this software ;; You are granted the rights to distribute and use this software
@ -12,12 +12,13 @@
;; authors ;; authors
;; - nik gaffney <nik@fo.am> ;; - nik gaffney <nik@fo.am>
;; - tim boykett <tim@timesup.org>
;; requirements ;; requirements
;; - ;; - qfwfq and descendants
;; commentary ;; commentary
;; - wobble -> heirarchical rectangular spread ;; - wobble -> hierarchical rectangular spread
;; - shuffle -> randomise positions ;; - shuffle -> randomise positions
;; - relax -> pseudo stabilisation using edge lengths ;; - relax -> pseudo stabilisation using edge lengths
;; - shadowpi -> variation on circular parent-centric splay ;; - shadowpi -> variation on circular parent-centric splay
@ -26,7 +27,9 @@
;; 2006-09-11 ;; 2006-09-11
;; - scraped into coherence from various sources ;; - scraped into coherence from various sources
;; 2006-11-12 ;; 2006-11-12
;; - mottled shadows, multiple beginings ;; - mottled shadows, multiple beginning
;; 2006-11-26
;; - reshaping showdowpi with help from Dr Boykett
(module layout mzscheme (module layout mzscheme
@ -41,8 +44,7 @@
(provide wobble-tree (provide wobble-tree
shuffle-tree shuffle-tree
relax-tree relax-tree
shadowpi-tree shadowpi-tree)
shadowtwopi-tree)
;;;;;; ; ; ;; ;;;; ;; ; ;; ;;;;;; ; ; ;; ;;;; ;; ; ;;
@ -98,7 +100,7 @@
;;;;; ;;;;;; ;; ; ;; ; ;;;;; ;;;;;; ;; ; ;; ;
;; ;;
;; energy stabilisation ;; energy stabilisation
;; - single itteration only, call as reqd. ;; - single iteration only, call as reqd.
;; - local epsilon & delta only ;; - local epsilon & delta only
;; ;;
;;;;; ; ;;; ; ; ;;;;; ; ;;; ; ;
@ -177,6 +179,7 @@
(define (-ve n) (define (-ve n)
(- 0 n)) (- 0 n))
;;;;;;;;;;; ;; ; ;; ; ;;;;;;;;;;; ;; ; ;; ;
;; ;;
;; circular parent centric layout, in the shade of twopi ;; circular parent centric layout, in the shade of twopi
@ -195,7 +198,7 @@
[e (length parents)] [e (length parents)]
[xi (snip-x node)] [xi (snip-x node)]
[yi (snip-y node)] [yi (snip-y node)]
(b (/ pi (if (eq? e 0) 1 e))) (b (/ pi (if (eq? e 0) 1 e))) ;; twopi -> full circle
(a (- (+ theta (/ pi 2)) (/ b 2))) (a (- (+ theta (/ pi 2)) (/ b 2)))
(r1 (* 2 r (sin (/ b 2))))) (r1 (* 2 r (sin (/ b 2)))))
@ -208,27 +211,6 @@
(shadowpi-tree parent pb a r1) (shadowpi-tree parent pb a r1)
(set! a (- a b)))) (set! a (- a b))))
parents))) parents)))
(define (shadowtwopi-tree node pb theta r)
;; given a node from which to draw the layout, angle theta, radius, r
(let* ([parents (send node get-parents)]
[e (length parents)]
[xi (snip-x node)]
[yi (snip-y node)]
(b (/ twopi (if (eq? e 0) 1 e)))
(a (- (+ theta (/ pi 2)) (/ b 2)))
(r1 (* 2 r (sin (/ b 2)))))
;; distribute parents of given node evenly along a containment circle
;; centered on the node.
(for-each (lambda (parent)
(let ((x1 (+ xi (* r (cos a))))
(y1 (+ yi (* r (sin a)))))
(send pb move-to parent x1 y1)
(shadowpi-tree parent pb a r1)
(set! a (- a b))))
parents)))
) ;; end of module ) ;; end of module

View file

@ -59,7 +59,6 @@
relax-tree relax-tree
eval-tree eval-tree
shadowpi-tree shadowpi-tree
shadowtwopi-tree
tree->sexp tree->sexp
to-string to-string

View file

@ -1,7 +1,7 @@
;; -*- mode: scheme -*- ;; -*- mode: scheme -*-
;; ;;
;; x a u e n e u a x - nqdataflow ;; x a u e n e u a x - nqdataflow
;; ;;
;; copyright (C) 2004 FoAM vzw ;; copyright (C) 2004 FoAM vzw
;; You are granted the rights to distribute and use this software ;; You are granted the rights to distribute and use this software
;; under the terms of the GNU Lesser General Public License as ;; under the terms of the GNU Lesser General Public License as
@ -23,8 +23,9 @@
;; ;;
;; keyboard controls ;; keyboard controls
;; C-n - adds new node, connected to a selected node ;; C-n - adds new node, connected to a selected node
;; C-c - conencts 2 selected nodes ;; C-c - connects 2 selected nodes
;; C-d - disconnects selected node ;; C-d - disconnects selected node
;; C-l - autolayout from selcted node
;; delete - deletes node ;; delete - deletes node
;; enter - evaluates current node ;; enter - evaluates current node
@ -117,8 +118,8 @@
(send next remove-child selected-snip))] (send next remove-child selected-snip))]
[(#\z) ;; C-z re.colour [(#\z) ;; C-z re.colour
(colour-tree selected-snip p)] (colour-tree selected-snip p)]
[(#\l) ;; C-x re.lapse [(#\l) ;; C-l re.lapse -> splay
(shadowtwopi-tree selected-snip p 0 80)] (shadowpi-tree selected-snip p 0 63)]
[(#\=) ;; C-= zoom->out [(#\=) ;; C-= zoom->out
(send p zoom 1.1)] (send p zoom 1.1)]
[(#\-) ;; C-- zoom->in [(#\-) ;; C-- zoom->in