I have an implementation of the ContextFree semantics in Scheme. Rendering is done via OpenGL.
Here's a screenshot of Larceny Scheme rendering the 'spirales' cfdg:
http://proteus.freeshell.org/abstractin ... irales.png
The code for the model in Scheme is given below.
I say the "semantics" are implemented because it doesn't accept the input in CFDG language, but rather as actual Scheme code.
The implementation and examples are available as part of a framework called 'abstracting':
http://github.com/dharmatech/abstracting/tree/master
Anybody who's curious to actually play with it, just follow the directions in the README. If you want to browse the code, it's in 'examples/cfdg'.
I think it's interesting that the implementation clocks in at 265 lines.
Feedback welcome!
Ed
Code: Select all
(cfdg-model
(define (chunk)
(block (lambda () (circle)))
(block (lambda () (size 0.3) (flip 60.0) (line))))
(define (a1)
(when (iterate?)
(block
(lambda ()
(size 0.95)
(x 2.0)
(rotate 12)
(brightness 0.5)
(hue 10.0)
(saturation 1.5)
(a1)))
(block (lambda () (chunk)))))
(define (line)
(alpha -0.3)
(block (lambda () (rotate 0) (a1)))
(block (lambda () (rotate 120) (a1)))
(block (lambda () (rotate 240) (a1))))
(set! background (lambda () (brightness -1)))
(set! viewport (vec -20 40 -20 40))
(set! start-shape (lambda () (line)))
(set! threshold 0.05))