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