Switch branches/tags
Nothing to show
Find file Copy path
0cfbb9a Sep 19, 2018
1 contributor

Users who have contributed to this file

executable file 53 lines (39 sloc) 1.54 KB
#!/usr/bin/sbcl --script
(load "../src/load")
(load "../utils/force")
(defun init-snek (n m size xy)
(let ((snk (snek:make :max-verts 5000)))
(lambda (g) (let ((mid (rnd:in-circ (* 0.5d0 (- size 200d0)) :xy xy)))
(snek:add-path! snk
(math:rep (p (math:linspace n 0d0 1d0 :end nil))
(vec:on-circ p 20d0 :xy mid))
:g g
:closed t)))
(math:nrep m (snek:add-grp! snk)))
(defun main (size fn)
(let ((itt 1000)
(grains 30)
(snk (init-snek 5 800 size (vec:rep (* 0.5d0 size))))
(sand (sandpaint:make size
:fg (pigment:white 0.05)
:bg (pigment:dark))))
(loop for i from 0 below itt do
(print-every i 100)
(snek:with (snk :zwidth 60.0d0)
(snek:itr-verts (snk v)
(map 'list (lambda (w) (force? snk v w -0.05))
(snek:verts-in-rad snk (snek:get-vert snk v) 60.0d0))
;(snek:with-verts-in-rad (snk (snek:get-vert snk v) 60d0 w)
; (cons))
(snek:itr-grps (snk g)
(snek:itr-edges (snk e :g g)
(force? snk (first e) (second e) 0.1))))
(snek:itr-grps (snk g :collect nil)
(sandpaint:bzspl-stroke sand
(bzspl:make (snek:get-grp-verts snk :g g) :closed t)
(sandpaint:save sand fn :gamma 1.5)))
(time (main 1000 (second (cmd-args))))