Coding Challenge 182: Apollonian Gasket Fractal @TheCodingTrain
Coding Challenge 182: Apollonian Gasket Fractal  @TheCodingTrain
Uploaded March 2024 | Updated November 2026, 3 days ago
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: thecodingtrain.com/challenges/182-apollonian-gasket

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

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

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

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

Related Coding Challenges:
πŸš‚ 21 Mandelbrot Set with p5.js: youtu.be/6z7GQewK-Ks
πŸš‚ 22 Julia Set in Processing: youtu.be/fAsaSkmbF5s
πŸš‚ 77 Recursion: youtu.be/jPsZwrV9ld0
πŸš‚ 50 Circle Packing: youtu.be/QHEQuoIKgNE
πŸš‚ 95 Approximating the Value of Pi: youtu.be/5cNnf_7e92Q
πŸš‚ 96 Visualizing the Digits of Pi: youtu.be/WEd_UIKG-uc
πŸš‚ 97 The Book of Pi: youtu.be/tbvG9hrJxOU
πŸš‚ 139 Calculating Digits of Pi with Collisions: youtu.be/PoW8g67XNxA
πŸš‚ 140 Leibniz Formula for Pi: youtu.be/uH4trBNn540
πŸš‚ 141 Calculating Digits of Pi with Mandelbrot Set: youtu.be/pn2vlselv_g
πŸš‚ 169 Pi in the Sky Game: youtu.be/_H9JIwWP7HQ
πŸš‚ 176 Buffon's Needle: 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: thecodingtrain.com
πŸ‘Ύ Share Your Creation! thecodingtrain.com/guides/passenger-showcase-guide
🚩 Suggest Topics: github.com/CodingTrain/Suggestion-Box
πŸ’‘ GitHub: github.com/CodingTrain
πŸ’¬ Discord: thecodingtrain.com/discord
πŸ’– Membership: youtube.com/thecodingtrain/join
πŸ›’ Store: standard.tv/codingtrain
πŸ–‹οΈ Twitter: twitter.com/thecodingtrain
πŸ“Έ Instagram: instagram.com/the.coding.train

πŸŽ₯ Coding Challenges: youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Intro to Programming: youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

πŸ”— p5.js: p5js.org
πŸ”— p5.js Web Editor: editor.p5js.org
πŸ”— Processing: processing.org

πŸ“„ Code of Conduct: github.com/CodingTrain/Code-of-Conduct

This description was auto-generated. If you see a problem, please open an issue: github.com/CodingTrain/thecodingtrain.com/issues/new

#apolloniangasket #pi #circlepacking #complexnumbers #curvature #descartestheorem #p5js #javascript
=====================================================
Coding Challenge 182: Apollonian Gasket FractalSide Project Saturday!#genuary9Discord Bots 1: Introduction2.1: Variables in p5.js (mouseX, mouseY) - p5.js TutorialCoding Train Live: Riding the Oregon Trail 2What was Coding like 40 years ago?print(Hello, Shorts!) #shortsHexagonal Cellular Automata #genuary10 #genuaryDiscord Bots 3: Coding a Bot with discord.jsAll Aboard (ish)MoveNet vs. PoseNet? (Coding Train Live!)
The Coding Train |

Coding Challenge 182: Apollonian Gasket Fractal

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER