Giter Site home page Giter Site logo

lsysint's Introduction

LSysInt

A simple L-System parser, interpreter and renderer, written in VB.NET

This is, in fact, a very rough and simple interpreter to render L-system formulas.

LSysInt rendering the Helge von Koch curve

The grammar is very similar to that of the more mature project LILiS, with a few distinctions:

  • A curve is defined using a name with its body enclosed between curly brackets.
  • Parameters names must always end with a colon.
  • So far, only eigth parameters are supported:
    • level: indicates the maximum recursion level
    • axiom: indicates the initial conditions
    • rule: indicates one or more rules to be applied to the axiom
    • angle: defines the default angle when none is specified
    • offsetX: defines a rendering origin offset in the horizontal direction
    • offsetY: defines a rendering origin offset in the vertical direction
    • length: defines the default length of a segment when none is specified
    • constant: defines a simple string-based substitution (no function support yet)
  • Although LSysInt does not currently support "definitions", most of the time these can be represented through one or more rules.
  • These are the currently supported internal functions:
    • F(x): move forward and draw x amount of pixels
    • B(x): move backwards and draw x amount of pixels
    • f(x): move forward x amount of pixels
    • +(x): increase the angle by x amount
    • -(x): decrease the angle by x amount
    • [: save current vector state
    • ]: restore saved vector state
    • %(r, g, b, a): set vector color

Here's a sample code to render the dragon curve up to its 13th iteration:

    Dragon {
        level: 13
        axiom: -(45) f(0.47) * F(0.6) X(0.6)
        rule: X(n) = X(n/Sqrt(2)) +(90) Y(n/Sqrt(2)) F(n/Sqrt(2)) +(90)
        rule: Y(n) = -(90) F(n/Sqrt(2)) X(n/Sqrt(2)) -(90) Y(n/Sqrt(2))
        rule: F(n) = F(n/Sqrt(2))
        rule: *    = * -(45)
    }

LSysInt rendering the Dragon

lsysint's People

Contributors

morphx666 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.