Coding Challenge #2: Menger Sponge Fractal

Subscribers:
1,740,000
Published on ● Video Link: https://www.youtube.com/watch?v=LG8ZK-rRkXo



Category:
Tutorial
Duration: 14:01
296,571 views
5,907


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







Tags:
menger sponge source code
10 minute coding challenge
ten minute coding challenge
menger sponge tutorial
menger sponge
coding challenge
challenge
3d coding
fractal tutorial
fractals
Object Oriented
Object Oriented Programming
OOP
sponge menger java
menger
3d box
Processing
cube
menger sponge java
menger sponge processing
sponge fractal js
how write code for menger sponge
creative coding
processing tutorial
menger cube code
menger sponge fractal
arraylist