Giter Site home page Giter Site logo

leungjch / epicycles.js Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3.54 MB

Interactive implementation of mathematical epicycles using p5.js. Allows for visual representation of Fourier series. Play with the demo at:

Home Page: https://leungjch.github.io/epicycles.js

HTML 0.01% JavaScript 99.83% CSS 0.01% Python 0.16%

epicycles.js's Introduction

epicycles.js

Interactive implementation of mathematical epicycles using p5.js. Allows for visual representation of Fourier series and pretty shapes (such as Spirograph patterns).

Details

Click "add epicycles" to add an epicycle. Adjust the first and second sliders on the bottom to adjust the radius and velocity of the epicycle, respectively. Ajust the slider at the top to change the speed of the simulation.

How to plot Fourier Series

You can also input numeric or variable values for the radii and velocities of the epicycles. To simulate an infinite Fourier series, use the variable j, which represents the index of the epicycle (starting from zero), and press "duplicate 100".

For example, to plot the Square Wave:

200/(2*j+1) in the radius input

2*j+1 for the velocity input.

Some other cool Fourier Series:

Sawtooth Wave:

100/(j+1)

(2*(j+1))*2

Triangle path generator:

(j+1)%3==0 ? v=0: v=100/(pow(j+1,2))

(j+1)%3==0 ? v=0: v=(j+1)*pow(-1,j%3+1)

Weierstrass Fractal (continuous everywhere, differentiable nowhere):

300/pow(3,j)

pow(3,(j))

Spirogpraphs

To generate Spirograph shapes, enable the "path line" option and play around with the radii and velocities of two epicycles.

epicycles.js's People

Contributors

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