MENU

Fun & Interesting

Coding Challenge 182: Apollonian Gasket Fractal

The Coding Train 91,815 lượt xem 11 months ago
Video Not Working? Fix It Now

Happy Pi Day 2024! In this video, I attempt to create an Apollonian Gasket using the Descartes Circle Theorem and complex numbers. So many circles! Code: https://thecodingtrain.com/challenges/182-apollonian-gasket

πŸš€ Watch this video ad-free on Nebula https://nebula.tv/videos/codingtrain-coding-challenge-182-apollonian-gasket

p5.js Web Editor Sketches:
πŸ•ΉοΈ Apollonian Gasket: https://editor.p5js.org/codingtrain/sketches/zrq8KHXnO
πŸ•ΉοΈ Colorful Recursive Gaskets in Gaskets: https://editor.p5js.org/codingtrain/sketches/leBpmVwaM

πŸŽ₯ Previous: https://youtu.be/Bxdt6T_1qgc?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ All: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
πŸ”— Apollonian Gasket: https://en.wikipedia.org/wiki/Apollonian_gasket
πŸ”— A Tisket, a Tasket, an Apollonian Gasket: https://www.americanscientist.org/article/a-tisket-a-tasket-an-apollonian-gasket
πŸ”— Apollonian Gaskets: https://mathlesstraveled.com/2016/04/27/apollonian-gaskets/
πŸ”— Beyond the Descartes Circle Theorem: https://arxiv.org/pdf/math/0101066.pdf
πŸ”— The Kiss Precise: https://www.nature.com/articles/1371021a0#preview
πŸ”— Frederick Soddy: https://en.wikipedia.org/wiki/Frederick_Soddy
πŸ”— Problem of Apollonius: https://en.wikipedia.org/wiki/Problem_of_Apollonius
πŸ”— Four Proofs of a Generalization of the Descartes Circle Theorem: https://www.jstor.org/stable/2316373
πŸ”— Beyond the Descartes Circle Theorem: https://arxiv.org/pdf/math/0101066.pdf
πŸ”— Descartes' theorem: https://en.wikipedia.org/wiki/Descartes%27_theorem
πŸ”— Complex.js: https://www.npmjs.com/package/complex.js

Related Coding Challenges:
πŸš‚ 21 Mandelbrot Set with p5.js: https://youtu.be/6z7GQewK-Ks
πŸš‚ 22 Julia Set in Processing: https://youtu.be/fAsaSkmbF5s
πŸš‚ 77 Recursion: https://youtu.be/jPsZwrV9ld0
πŸš‚ 50 Circle Packing: https://youtu.be/QHEQuoIKgNE
πŸš‚ 95 Approximating the Value of Pi: https://youtu.be/5cNnf_7e92Q
πŸš‚ 96 Visualizing the Digits of Pi: https://youtu.be/WEd_UIKG-uc
πŸš‚ 97 The Book of Pi: https://youtu.be/tbvG9hrJxOU
πŸš‚ 139 Calculating Digits of Pi with Collisions: https://youtu.be/PoW8g67XNxA
πŸš‚ 140 Leibniz Formula for Pi: https://youtu.be/uH4trBNn540
πŸš‚ 141 Calculating Digits of Pi with Mandelbrot Set: https://youtu.be/pn2vlselv_g
πŸš‚ 169 Pi in the Sky Game: https://youtu.be/_H9JIwWP7HQ
πŸš‚ 176 Buffon's Needle: https://youtu.be/h5ZNcAPXxew

Timestamps:
0:00 Happy PI Day!!
1:40 References
3:22 Describe the Apollonian problem
5:51 Curvature
10:08 Start coding!
11:53 Write a function to find the fourth curvature
15:31 Complex numbers
21:11 Create a complex number class
22:52 Square root of -1
25:32 Square root of a complex number
27:57 Implement complex Descartes theorem
33:50 Make the circles in the complexDescartes function
36:26 Use an array to add recursion
41:04 Validate the circles
42:35 Check if all 4 circles are tangent
48:04 Stop adding circles when radius falls below a threshold
49:20 Implement arbitrary arrangement of circles
53:14 Debug
55:32 Possible variations
56:34 Outro

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

πŸš‚ Website: https://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://thecodingtrain.com/discord
πŸ’– 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

#apolloniangasket #pi #circlepacking #complexnumbers #curvature #descartestheorem #p5js #javascript
=====================================================

Comment