Draw the locus of a point on a circle rolling on an arbitrary parametric function. To use the online drawer, please visit https://hanzhi713.github.io/Parametric-Roulette/index.html.
See here
Equation | JS-generated GIF |
---|---|
Config is available here |
Equation | JS-generated GIF |
---|---|
Config is available here |
Equation | JS-generated GIF |
---|---|
Config is available here |
Heart | Astroid | Hypocycloid (k=4) | Rose (p=3) |
---|---|---|---|
download config | download config | download config | download config |
Recent versions of Chrome/Firefox are recommended. Require ES6 support. Not tested on other browsers.
Note: most settings have tooltips which explain their function. Hover your mouse over too see the tooltip.
- On the right side, enter your parametric equation, , both as functions of .
- Enter the lower/upper limit of .
- Add some dots, manually or randomly generate
- Hit "preview" and then "draw"
- while not satisfied:
- Auto-adjust or manually change the scaling/translation (dx/dy/s)
- Adjust the circle radius or use 👈 button to generate a radius
- Adjust the drawing step to gain more accuracy
- Tweak the dot parameters
- Change signs and rotation directions
- Change other settings
- Finally, export your customized parametric roulette by clicking "save", "save to PNG" or "save to GIF" (on the dropdown)
Alternatively, you can start from a config given in any examples above and tweak settings. To load a config (a JSON file), use the "Load Config" button on the left panel to upload your .json config.
Signs are a series of buttons for determining at which side of the curve the circle should appear and the rotation direction of the circle. 🔄 is the button for resetting them and R is button to reverse all of them. Each time you change settings except for a few (like the parametric equation, t range, etc.), signs are preserved. If the resulting roulette is strange, please try to use 🔄 to reset signs and rotation directions. In most cases, the default-generated signs are optimal and you only need to use the R button rather than changing them individually. Please check Mechanism.md for details.
Note: no compilers/bundlers other than the typescript compiler are used to keep things simple for this small project
Make sure you have node.js >= 10.16
Clone this repository and install dependencies
git clone https://github.com/hanzhi713/Parametric-Roulette
npm install
Then, run the file watcher. It basically calls the typescript compiler and a script that removes the import statements from the compiled js file.
npm run dev
Finally, open a local static file server, using http-server, python's http.server or any other server of your preference.
README.md and Mechanism.md are compiled from README.tex.md and Mechanism.tex.md which contain inline latex formulae. You need to have the package readme2tex installed in order to compile.
pip install readme2tex
Then, you can run the compile script
bash build_tex.sh
Originally I planned to implement this using JavaScript as an extension and generalization to my "Flowers-curve" repository (which is about drawing the locus of a point on circle rolling along another circle). However, I was unable to find a JavaScript library that can evaluate the definite integral for the arc length function accurately and efficiently. Therefore, I initially made the prototype with Geogebra. The geogebra file could be found in the doc folder.
Now, the JS drawer is successfully implemented as I found Nerdamer for symbolic differentiation and I used the trapezoidal rule for numerical integration.
The interface of my JavaScript drawer is adapted from my Spirograph drawer. New inputs are annotated by tooltips. It works best on Chrome and Firefox. Not tested on other browsers.