Saturday, July 2, 2011

Functional geometry

When I started using Clojure I could only find imperative graphics manipulation systems. I eventually realised that functional geometry is the Lispy way of dealing with graphics so I created a functional geometry library:

(polygon [100 100] [[0 0] [0 100] [100 100] [100 0] [0 0]])

Each function creates a picture data-type. The procedure display! can be used to display any picture on a graphics instance:

(display! (select-region g [[0 0] [100 100]]) picture)