Discussion:
[Larceny-users] gl/glut milestone: rendering CFDG models
Eduardo Cavazos
2009-02-07 02:42:40 UTC
Permalink
Hello,

ContextFree is a program which renders pretty pictures given programs
expressed in a very concise language:

http://www.contextfreeart.org/

Here is one such example:

http://www.contextfreeart.org/gallery/view.php?id=541

I implemented the ContextFree semantics and rendering system. Here's a
screenshot of Ypsilon executing such a rendering:

Loading Image...

Note, this is a pure Scheme implementation; I'm not depending on the
ContextFree code at all.

I'm mentioning it here because the demo also runs in Larceny, unchanged.

A very sketchy early implementation is here:

http://proteus.freeshell.org/_cfdg-window-a.scm

Here's an example of embedding cfdg rules in Scheme. Here's some code
from the original chiaroscuro rendering:

----------------------------------------------------------------------
rule BLACK 60 {
CIRCLE {s .6}
BLACK {x .1 r 5 s .99 b -.01 a -.01}
}
rule BLACK {
WHITE {}
BLACK {}
}
----------------------------------------------------------------------

The following is an explicit representation of what's going on. It's
much longer than the cfdg syntax; an opportunity for syntax-rules. :-)

----------------------------------------------------------------------
(define (black)
(when (iterate?)
(call-random-weighted
(vec
(vec 60 (lambda ()
(block
(lambda ()
(size 0.6)
(circle)))
(block
(lambda ()
(x 0.1)
(rotate 5)
(size 0.99)
(brightness -0.01)
(alpha -0.01)
(black)))))
(vec 1 (lambda ()
(block
(lambda ()
(white)
(black)))))))))
----------------------------------------------------------------------

Anyway, I just wanted to share this milestone; the first rendering
happened about 10 minutes ago. :-)

The code's very sketchy. I'll share a cleaned up version.

Ed

Loading...