Coding Challenge #17: Fractal Trees - Space Colonization

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



Duration: 45:53
129,228 views
1,975


In this coding challenge, I'm using the space colonization algorithm to make a tree generator. This is the 4th part of my algorithmic botany series. Code: https://thecodingtrain.com/challenges/17-fractal-trees-space-colonization

πŸ•ΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/r9pxis9g-

πŸŽ₯ Previous video: https://youtu.be/E1B4UoSQMFw?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Next video: https://youtu.be/JcopTKXt8L8?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
🌳 Algorithmic Botany: http://algorithmicbotany.org/
πŸ““ Space Colonization Algorithm: https://algorithmicbotany.org/papers/colonization.egwnp2007.html
πŸ“• Nature of Code class on Kadenze: https://www.kadenze.com/courses/the-nature-of-code/info

Videos:
πŸŽ₯ Algorithmic Botany Track: https://thecodingtrain.com/tracks/algorithmic-botany
πŸ”΄ Coding Train Live 40: https://youtu.be/MwLyeEWnMCY?t=7899s

Related Coding Challenges:
πŸš‚ #14 Recursive Fractal Trees: https://youtu.be/0jjeOYMjmDU
πŸš‚ #18 3D Fractal Trees: https://youtu.be/JcopTKXt8L8
πŸš‚ #77 Recursion: https://youtu.be/jPsZwrV9ld0
πŸš‚ #174 AppleSoft Basic Fractal Tree: https://youtu.be/UNkHditYGls

Timestamps:
0:00 Introducing today's topic
1:34 The space colonization algorithm
3:11 Write a Tree constructor function
3:46 Write a Leaf construction function
5:03 Add a tree
6:53 Create a branch object that has a position and a parent
7:45 Add the root of the tree
9:26 Add a direction to the branch
10:41 Minimum and maximum distance
14:45 Add a function to add the next branch
17:35 Add a show function
20:00 Add a grow function to determine the closest branch to each leaf
22:20 Mark leaves that are reached
28:06 "Pull" the direction of closest branch toward the leaf
30:00 Add a count variable to the Branch variable
32:06 Loop backwards through the leaf array to delete leaves that were reached
33:02 Determine whether a branch was attracted to a leaf
34:01 Average the branch's direction
34:30 Make a new branch
36:59 Reset the branches
42:55 Add a default length to the branches
43:50 Suggestions for improvements

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

#fractals #generativeart #spacecolonization #p5js #javascript







Tags:
space
coding
challenge
patreon
processing
daniel shiffman
p5.js
processing tutorial
nature of code
tutorial
p5js
coding challenge
object oriented programming
creative coding
programming challenge
p5.js tutorial
object oriented
oop
javascript (programming language)
simulation
space colonization
space colonization algorithm
algorithmic botany