Geometer

3D Koch curve, Jack Rusher.

As part of my continuing efforts to get the Clojure community to notice Karsten Schmidt and creative coders to notice Clojure, I've created a little interactive playground for experiments with Karsten's th.ing libraries.

You can have a play with a live version here. The code and instructions are here.

Of particular note is the concision with which complex forms can be specified. For example, this code:

(defn branch
"A recursive branching tree structure with half-cylinder flowers."
  [level]
  (if (= 0 level)
    [(length 1.5) cylinder]
    [(angle (fn [_] (m/random 3 5))) ry-
     (length (fn [t] (* (m/random 0.75 1.5) (or (:last-length t) 1.5))))
     (map (fn [[a b]] (concat (take 8 (cycle [a b])) (branch (dec level))))     
          [[ry line] [ry- line] [rx line] [rx- line]])]))

Produced this L-system alien plant:

L-system plant, Jack Rusher.

As ever, let me know if you make anything with it.

This entry is part of my journal, published November 23, 2015, in Berlin.