Coding Challenge #33: Poisson-disc Sampling
In this coding challenge, I implement a "Poisson-disc Sampling" algorithm to evenly (but randomly) distribute a set of seed points throughout a canvas. The algorithm is implemented in JavaScript using p5.js. Code: https://thecodingtrain.com/challenges/33-poisson-disc-sampling
๐น๏ธ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/4N78DFCXN
๐ฅ Previous video: https://youtu.be/JXuxYMGe4KI?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
๐ฅ Next video: https://youtu.be/Cl_Gjj80gPE?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
๐ฅ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
References:
๐ Poisson Disc: https://www.jasondavies.com/poisson-disc/
๐ Paper on Fast Poisson Disc Sampling in Multiple Dimensions: http://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf
Live Stream Archive:
๐ด Coding Train Live 56: https://youtu.be/2S0J5iiQ0nw?t=1935s
Related Coding Challenges:
๐ #98 Quadtree: https://youtu.be/OJxEcs0w_kE
๐ #70 Nearest Neighbors Recommendation Engine: https://youtu.be/N8Fabn1om2k
๐ #95 Approximating the Value of Pi: https://youtu.be/5cNnf_7e92Q
Timestamps:
0:00 Introduction to Poisson Disc Sampling!
1:30 Starting to code!
3:00 Creating a 2D background grid
6:52 Inserting initial sample into a random position in the grid
10:25 Creating an active list of points
14:40 Generating up to k points
19:18 Checking neighboring samples
25:40 Removing inactive points from list
27:30 Debugging
36:50 Playing with the code!
41:25 Things you can do!
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://thecodingtrain.com/discord
๐ 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
#poissondiscsampling #simondenispoisson #p5js #processing