Coding Challenge #17: Fractal Trees - Space Colonization
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