11:42Coding Challenge #33: Poisson-disc Sampling
From the creator
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
Published 2016-08-22 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.





