andrewcb / Flowsnake

Code to generate and render the Gosper Curve, in Haskell for Mac

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flowsnake

Some code for calculating, and drawing the Gosper Curve (or “Flowsnake”) in Haskell. This code was developed as a Haskell for Mac playground, though almost all the code is in Haskell source files which could be used in standalone code. Hopefully it's reasonably comprehensible (if probably not optimally elegant).

In this code, the Gosper curve is internally represented as a 3-dimensional object, which is collapsed to 2D using an isometric projection. This produces the same image as the traditional L-system implementation, involving 60º rotations in a 2D plane, but has the advantage of an intermediate format that is more usable for pattern-generating applications (my motivation to look into space-filling curves came from Herman Haverkort's research into their musical applications).

This code depends on the Graphics.Rasterific and Codec.Picture raster-image rendering libraries to make its images. These ship with Haskell for Mac, but otherwise may be added using Cabal/Stack. Making this application build as a standalone command-line app is left as an exercise for the reader.

About

Code to generate and render the Gosper Curve, in Haskell for Mac


Languages

Language:Haskell 100.0%