Coding Challenge #61: Fractal Spirograph
In this coding challenge, I attempt to create a "Fractal Spirograph" with Processing (Java). The visuals are inspired by images and explanation on C. J. Chenβs blog. Code: https://thecodingtrain.com/challenges/61-fractal-spirograph
πΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/Q60oWddzr
π₯ Previous video: https://youtu.be/O_0fRV4MTZo?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Next video: https://youtu.be/KakpnfDv_f0?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
References:
π C.J.Chen's blog on Fractal Spirograph: http://benice-equation.blogspot.ca/2012/01/fractal-spirograph.html
Videos:
π₯ My Video on Polar Coordinates: https://youtu.be/O5wjXoFrau4
π₯ Live Stream #81: Fractal Spirograph: https://youtu.be/S5Qj-JgAN-M
Related Coding Challenges:
π #7 Solar System (2D): https://youtu.be/l8SiJ-RmeHU
π #55 Mathematical Rose Patterns: https://youtu.be/f5QBExMNB1I
π #116 Lissajous Curve Table: https://youtu.be/--6eyLO78CY
Timestamps:
0:00 Introduction
1:45 Benice equation
3:26 The solar system coding challenge
4:45 Polar to cartesian coordinates
5:53 Draw first circle
6:44 Add a second circle
8:54 Use polar coordinates to find radius of second circle
9:52 Increment the angle to rotate second circle around first circle
11:02 Save the points of the path of the second circle
14:07 Add an Orbit class
16:41 Linked lists
19:01 Write an addChild() function
23:20 Write a loop to add the next child
24:47 Write an update function
27:14 Add a speed variable
31:23 Trace the path
33:43 Get the formula
34:39 Have each orbit keep track of its level
35:27 Use the formula to calculate the speed
40:13 Bonus addendum with improvements
40:28 Adjust angle to have pattern point up
41:23 Adjust resolution
43:51 Thanks for watching!
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
π Website: http://thecodingtrain.com/
πΎ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
π© Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
π‘ GitHub: https://github.com/CodingTrain
π¬ Discord: https://discord.gg/hPuGy2g
π Membership: http://youtube.com/thecodingtrain/join
π Store: https://standard.tv/codingtrain
ποΈ Twitter: https://twitter.com/thecodingtrain
πΈ Instagram: https://www.instagram.com/the.coding.train/
π₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
π p5.js: https://p5js.org
π p5.js Web Editor: https://editor.p5js.org/
π Processing: https://processing.org
π Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct
This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new
#fractal #spirograph #polarcoordinates #processing #java