Coding Challenge #33: Poisson-disc Sampling

Subscribers:
1,750,000
Published on ● Video Link: https://www.youtube.com/watch?v=flQgnCUxHlw



Duration: 42:16
82,927 views
1,470


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







Tags:
coding
challenge
poisson
disc
p5.js
daniel shiffman
p5js
creative coding
p5.js tutorial
nature of code
algorithm
coding challenge
patreon
programming challenge
js
poisson disc sampling
poisson disk sampling
Simรฉon Denis Poisson