Coding Challenge #34: Diffusion-Limited Aggregation
In this coding challenge, I explore the generative algorithm "Diffusion-Limited Aggregation". The pattern is generated from random walkers clustering around a seed (or set of seed) point(s). Code: https://thecodingtrain.com/challenges/34-diffusion-limited-aggregation
πΉοΈ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/XpS9wGkbB
π₯ Previous video: https://youtu.be/flQgnCUxHlw?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Next video: https://youtu.be/BAejnwN4Ccw?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
References:
πΎ Atom Live Server Package: https://atom.io/packages/atom-live-server
π Diffusion-Limited Aggregation on Wikipedia: https://en.wikipedia.org/wiki/Diffusion-limited_aggregation
π DLA reference: http://paulbourke.net/fractals/dla/
Related Coding Challenges:
π #15 Object-Oriented Fractal Trees: https://youtu.be/fcdNSZ9IzJM
π #52 Random Walker: https://youtu.be/l__fEY1xanY
π #127 Brownian Tree Snowflake: https://youtu.be/XUA8UREROYE
Timestamps:
0:00 Welcome to another Coding Challenge
1:10 The DFA algorithm
3:36 Create a tree array
4:30 Create a random walker
8:44 Release mulitple walkers at a time
10:11 Create a Walker object
12:39 Create an array of walkers
13:14 Use optional arguments to initialize x and y
15:30 Display the objects in the tree and walker arrays
17:12 Push a walker to the tree array when it gets "stuck"
19:18 Change the color of the walkers that are stuck
19:47 Move the walkers multiple times per frame
21:37 Eliminate the square root calculation to improve the rendering speed
26:17 Add a random point along the edges
28:34 Add fewer walkers with a large number of iterations
29:15 Try different patterns
32:39 Different creative possibilities
36:00 Let each walker have its own radius
41:45 Shrink the radius for each new walker
43:30 Add a terminal condition
44:06 Map the hue to the radius of each walker
45:13 Thanks for watching!
46:08 Bonus addendum: improvements to code
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
#paulbourke #diffusionlimitedaggregation #p5js #javascript