Clojure GUI Demo of 3D Graphing

Launch Clojure GUI Demo of 3D Grapher of Parametric Equations

Ever wondered about parametric equations? They’re a slightly different take on your classic functions of x and y in Euclidean space. Your ordinary equation y=x… gets expressed in terms of another variable.  For linear equations this doesn’t make much difference, but for more complex equations, such as a circle – it actually makes things simpler. For a circle the graph x2 + y2 = 1 might be rearranged to be y = +/-sqrt(1 – x2) for drawing a graph. For a parameter version we change it to (sin(t), cos(t)) for a small range of t (+/- 2 PI), and drawing our graph just got a whole lot easier.

But what we’re really into is drawing graphs that represent this idea:

Parametric Grapher

So this is based on some work by Curran Kelleher here. You can try it via Web Start here.

Equations to try:

 (var-set x u) (var-set y v) (var-set z (sin (/ (* u v) 10)))
 (var-set x u) (var-set y v) (var-set z (* u (sin (/ (* u v) 20))))
 (var-set x u) (var-set y v) (var-set z (sin u))

This presented some interesting challenges to package up. I have a greater respect for Zach Tellman and his work on Penumbra in terms of neat packaging of jogl libraries.

I got the JOGL libraries from here and here.  I packaged the libraries up for leiningen using this.  The only trick after that was ripping out all the other jar signatures and making sure they all had mine. (Manual process)

Leave a Reply

Your email address will not be published. Required fields are marked *