Skip to content

Rigellute/L-system-reasonml

Repository files navigation

L-system plant in Reprocessing

screen shot 2018-04-08 at 12 11 35

An L-system or Lindenmayer system is a parallel rewriting system and a type of formal grammar. An L-system consists of an alphabet of symbols that can be used to make strings, a collection of production rules that expand each symbol into some larger string of symbols, an initial "axiom" string from which to begin construction, and a mechanism for translating the generated strings into geometric structures.

This fractal plant is based on

variables : X F
constants : + − [ ]
start  : X
rules  : (X → F+[[X]-X]-F[-FX]+X), (F → FF)
angle  : 25°

Here, F means "draw forward", − means "turn left 25°", and + means "turn right 25°". X does not correspond to any drawing action and is used to control the evolution of the curve. The square bracket "[" corresponds to saving the current values for position and angle, which are restored when the corresponding "]" is executed.

How to Run

Clone

https://github.com/Rigellute/L-system-reasonml.git

Install

yarn

Build

yarn build

Start

yarn start

To build to JS run npm run build:web and then run a static server, like python -m SimpleHTTPServer and go to localhost:8000. If you're using safari you can simply open the index.html and tick Develop > Disable Cross-Origin Restrictions.

To build to native run npm run build:native and run npm run start:native

The build system used is bsb-native.

About

L-system tree in ReasonML using Reprocessing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published