Code Monkey home page Code Monkey logo

koch-snowflake's Introduction

koch-snowflake

Koch snowflake partial fractal implementation in P5js

See Wikipedia page

P5js

P5js is a Javascript library allowing easy drawing in a browser, see here

Implementation

The base triangle is set to have is center in the widdle of the window, having the top line horizontal. The length of the first side is set to be 75% of the minimal sketch dimension.

The iteration consist in iterating through the already existing points and inserting the new one at each iteration.

The width of the segment is decreasing at each iteration (2^(-n)) for better visibility.

How to preview

Download the html and Javascript file, make sure they are in the same directory and open the html file in your browser.

How to use

The sketch is set to not auto-refresh, to make a new iteration press the space key, to reset the snowflake to the base triangle press the d key.

koch-snowflake's People

Contributors

maxime915 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.