Coding Challenge 182: Apollonian Gasket Fractal
The Coding Train The Coding Train
1.68M subscribers
72,257 views
0

 Published On Mar 14, 2024

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

šŸš€ Watch this video ad-free on Nebula https://nebula.tv/videos/codingtrain-...

p5.js Web Editor Sketches:
šŸ•¹ļø Apollonian Gasket: https://editor.p5js.org/codingtrain/s...
šŸ•¹ļø Colorful Recursive Gaskets in Gaskets: https://editor.p5js.org/codingtrain/s...

šŸŽ„ Previous: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ 181:Ā WeightedĀ Vorono...Ā Ā 
šŸŽ„ All: Ā Ā Ā ā€¢Ā CodingĀ ChallengesĀ Ā 

References:
šŸ”— Apollonian Gasket: https://en.wikipedia.org/wiki/Apollon...
šŸ”— A Tisket, a Tasket, an Apollonian Gasket: https://www.americanscientist.org/art...
šŸ”— Apollonian Gaskets: https://mathlesstraveled.com/2016/04/...
šŸ”— Beyond the Descartes Circle Theorem: https://arxiv.org/pdf/math/0101066.pdf
šŸ”— The Kiss Precise: https://www.nature.com/articles/13710...
šŸ”— Frederick Soddy: https://en.wikipedia.org/wiki/Frederi...
šŸ”— Problem of Apollonius: https://en.wikipedia.org/wiki/Problem...
šŸ”— 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/Descart...
šŸ”— Complex.js: https://www.npmjs.com/package/complex.js

Related Coding Challenges:
šŸš‚ 21 Mandelbrot Set with p5.js: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ #21:Ā MandelbrotĀ SetĀ ...Ā Ā 
šŸš‚ 22 Julia Set in Processing: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ #22:Ā JuliaĀ SetĀ inĀ Pr...Ā Ā 
šŸš‚ 77 Recursion: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ #77:Ā RecursionĀ Ā 
šŸš‚ 50 Circle Packing: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ #50.1:Ā AnimatedĀ Circ...Ā Ā 
šŸš‚ 95 Approximating the Value of Pi: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ 95:Ā ApproximatingĀ th...Ā Ā 
šŸš‚ 96 Visualizing the Digits of Pi: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ #96:Ā VisualizingĀ the...Ā Ā 
šŸš‚ 97 The Book of Pi: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ #97:Ā TheĀ BookĀ ofĀ PiĀ ...Ā Ā 
šŸš‚ 139 Calculating Digits of Pi with Collisions: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ #139:Ā CalculatingĀ Di...Ā Ā 
šŸš‚ 140 Leibniz Formula for Pi: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ #140:Ā PiĀ Approximati...Ā Ā 
šŸš‚ 141 Calculating Digits of Pi with Mandelbrot Set: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ #141:Ā CalculatingĀ Di...Ā Ā 
šŸš‚ 169 Pi in the Sky Game: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ 169:Ā PiĀ inĀ theĀ SkyĀ GameĀ Ā 
šŸš‚ 176 Buffon's Needle: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ 176:Ā Buffon'sĀ NeedleĀ Ā 

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 arbirtary 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/pas...
šŸš© Suggest Topics: https://github.com/CodingTrain/Sugges...
šŸ’” GitHub: https://github.com/CodingTrain
šŸ’¬ Discord: https://thecodingtrain.com/discord
šŸ’– Membership: http://youtube.com/thecodingtrain/join
šŸ›’ Store: https://standard.tv/codingtrain
šŸ–‹ļø Twitter: Ā Ā /Ā thecodingtrainĀ Ā 
šŸ“ø Instagram: Ā Ā /Ā the.coding.trainĀ Ā 

šŸŽ„ Coding Challenges: Ā Ā Ā ā€¢Ā CodingĀ ChallengesĀ Ā 
šŸŽ„ Intro to Programming: Ā Ā Ā ā€¢Ā StartĀ learningĀ here!Ā Ā 

šŸ”— 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-o...

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

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

show more

Share/Embed