Coding Challenge #17: Fractal Trees - Space Colonization

Subscribers:
1,750,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