GithubHelp home page GithubHelp logo

fractal_trees's Introduction

Fractal Trees

Introduction

Fractal Trees refers to a class of fractals that are generated by recursively applying a set of rules to a starting shape. The rules are applied to the starting shape to generate a new shape. The rules are then applied to the new shape to generate another shape. This process is repeated until the desired level of detail is reached.

Installation

To run the simulation, simply clone the repository and open the index.html file in your browser. Alternatively, you can visit the GitHub Pages for this repository.

Implementation

This is a very simple implementation of fractal trees. We can be more fancy and use a more complex set of rules to generate more complex fractal trees. We can also use a more complex starting shape to generate more complex fractal trees. E.g. (Code Train - Fractal Trees)[https://www.youtube.com/watch?v=fcdNSZ9IzJM] uses objects to represent the branches of the tree with position, angle, and length. This data allows us to manipulate the branches of the tree more easily.

Pseudocode

function drawTree(x, y, length, angle, depth) {
    if (depth > 0) {
        drawBranch(x, y, length, angle);
        drawTree(x, y, length * ratio, angle + 30, depth - 1);
        drawTree(x, y, length * ratio, angle - 30, depth - 1);
    }
}

Demo

Fractal Trees

References

  1. Fractal Tree Index
  2. Fractals
  3. P5 JS
  4. P5 JS Reference
  5. P5 JS Examples
  6. P5 JS Web Editor
  7. Coding train - P5 JS Tutorials
  8. The Nature of Code
  9. The Coding Train
  10. The Coding Train - Fractal Trees

fractal_trees's People

Contributors

ghostscypher avatar

Watchers

 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.