Giter Site home page Giter Site logo

mio10 / l-systems-fractals Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 42 KB

A collection of programs that generate fractal images based on L-systems

License: MIT License

Pascal 100.00%
dragon-curve fractal-plant fractals gosper-curve l-system pascal pascalabc pascalabcnet math-art

l-systems-fractals's Introduction

Fractals generated with L-systems

Description

A small collection of programs that generate some of well-known fractals using an algorithm based on L-systems. I wrote the program in 2017 when I was learning about fractals and L-systems in university. When developing this, I was highly inspired by the Wikipedia article about L-systems.

Dragon curve

L-system:

variables : F G
constants : + −
start  : F
rules  : (F → F+G), (G → F-G)
angle  : 90°
Here, F and G both mean "draw forward", + means "turn left by angle", and − means "turn right by angle".

Screenshot:

Fractal plant

L-system:

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 right 25°", and + means "turn left 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.

Screenshot:

Gosper curve

L-system:

angle : 60 degrees
axiom : A
replacement rules :
  A → A-B--B+A++AA+B-
  B → +A-BB--B-A++A+B
In this case both A and B mean to move forward, + means to turn left 60 degrees and - means to turn right 60 degrees - using a "turtle"-style program such as Logo.

Screenshot:

Requirements

PascalABC.NET is required to run the program.

Quick start

  1. Launch PascalABC.NET.
  2. Open the file corresponding to a fractal image you want to see (dragon.pas, fractal plant.pas or gosper.pas).
  3. Run the program.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.