Coding Challenge #2: Menger Sponge Fractal
In this coding challenge, I attempt to code the Menger Sponge (fractals) using Processing. Code: https://thecodingtrain.com/challenges/2-menger-sponge
πΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/5kcBUriAy
π₯ Previous video: https://youtu.be/17WoOqgXsRM?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Next video: https://youtu.be/AaGK-fj-BAM?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
References:
π Menger Sponge on Wikipedia: https://en.wikipedia.org/wiki/Menger_sponge
π΅ P3D Tutorial: https://processing.org/tutorials/p3d/
π΅ ArrayList in Processing: https://processing.org/reference/ArrayList.html
Videos:
π₯ Fractals in Processing: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6bXUJvjnMWGU5SmjhI-OXef
π΄ Coding Train Live 31: https://youtu.be/Md5LIDW0RyY?t=2738
Related Coding Challenges:
π #18 3D Fractal Trees: https://youtu.be/JcopTKXt8L8
π #123 Chaos Game: https://youtu.be/7gNzMtYo9n4
π #126 Toothpicks: https://youtu.be/-OL_sw2MiYw
π #129 Koch Fractal Snowflake: https://youtu.be/X8bXDKqMsXE
π #168 The Mandelbulb: https://youtu.be/NJCiUVGiNyA
Timestamps:
0:00 Welcome to a 10 minute Coding Challenge!
0:26 Quick math about the Menger Sponge
1:02 Code! Drawing a 3D box in Processing
2:14 Creating a Box class
3:36 Use a Box object instead of the hardcoded box
4:02 Chopping up one Box into multiple ones
6:53 Modeling the Menger Sponge as an ArrayList of Boxes
7:41 Generating the next iteration on mouse click
9:47 Bonus time! Adding 2 more minutes π
10:03 How to determine which boxes need to be removed?
10:48 Code! Removing the extra boxes
12:12 Enhancing the visuals
13:32 Done! The Menger Sponge in Processing
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 #3d #processing