Skip to content

Fractals mainly implemented using javascript and html5 canvas. Examples of depth-first-traversal and breadth-first-traversal of the graph. Object oriented design.

Notifications You must be signed in to change notification settings

besnik/fractals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Fractals

This projects aims to implement and investigate trees/graphs/fractals.

Implementation

Currently all code is done using javascript with help of jQuery library. Rendering is done using HTML5 and Canvas element.

Programs are implemented using object oriented designs and a variation of MVC pattern to decouple model from view layer.

Multiple tree fractals

Examples

  • tree_html5_canvas: contains basic implementation of binary tree fractal using javascript and html5 canvas.
  • tree_fractal_forest: same as above plus added generator to create random fractal configurations

Learning Source

The sources contains couple of interesting points one can learn. Programs are not simple and clean design with aim to decouple components allowed to design simple and clean classes.

Sources shows:

  • HTML 5 Canvas manipulation and drawing
  • Vector, Matrix, Rotations, etc
  • Losely coupled object oriented design in javascript

Calculation

Program uses basic arithmetic operations, vector and matrix multiplication and calculation of rotation matrix (rotation of vector around base).

Program uses depth-first-search of the graph (tree).

Fractal Tree Forest

Implementation

Implementation is done using object oriented design. All services are separated. Here we fully make use of dynamic language like javascript when passing config/context between services. Sometimes there is no need to create dedicated DTOs for satisfy interface but use existing DTOs/services. For target service this is transparent thanks to dynamic behaviour of the runtime.

Recursion (internally using stack of the called functions) is used to traverse tree (in depth first order) and calculate+draw branches.

About

Fractals mainly implemented using javascript and html5 canvas. Examples of depth-first-traversal and breadth-first-traversal of the graph. Object oriented design.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published