Coding Challenge 181: Weighted Voronoi Stippling

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



Duration: 28:59
173,798 views
7,276


Stippling is an artistic technique that uses numerous dots to craft an image. In this coding challenge I attempt to implement a weighted Voronoi stippling algorithm with p5.js along with the Delaunay triangulation package from d3.js. Code: https://thecodingtrain.com/challenges/181-image-stippling

๐Ÿš€ Watch this video ad-free on Nebula https://nebula.tv/videos/codingtrain-coding-challenge-181-weighted-voronoi-stippling

p5.js Web Editor Sketches:
๐Ÿ•น๏ธ Weighted Voronoi Stippling: https://editor.p5js.org/codingtrain/sketches/Z_YV25_4G
๐Ÿ•น๏ธ Circumcircle: https://editor.p5js.org/codingtrain/sketches/eJnSI84Tw
๐Ÿ•น๏ธ Delaunay Triangulation: https://editor.p5js.org/codingtrain/sketches/fuQz_-FnA
๐Ÿ•น๏ธ Voronoi Diagram: https://editor.p5js.org/codingtrain/sketches/GpeT1W8X1
๐Ÿ•น๏ธ Voronoi Phyllotaxis: https://editor.p5js.org/codingtrain/sketches/ydiZeUK8R
๐Ÿ•น๏ธ Voronoi Diagram colored by area: https://editor.p5js.org/codingtrain/sketches/opmU_UQqg
๐Ÿ•น๏ธ Lloyd's relaxation: https://editor.p5js.org/codingtrain/sketches/04sgsAcNu
๐Ÿ•น๏ธ Weighted Stippling - Size and Color: https://editor.p5js.org/codingtrain/sketches/_HTZUBPld
๐Ÿ•น๏ธ Weighted Stippling - Abstract Pattern: https://editor.p5js.org/codingtrain/sketches/9ntWWLXqA
๐Ÿ•น๏ธ Weighted Stippling - Video: https://editor.p5js.org/codingtrain/sketches/7TKSgi16z

๐ŸŽฅ Previous: https://youtu.be/L4u7Zy_b868?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
๐ŸŽฅ All: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

References:
๐Ÿ”— d3-delaunay: https://d3js.org/d3-delaunay
๐Ÿ”— Weighted Voronoi Stippling: https://www.cs.ubc.ca/labs/imager/tr/2002/secord2002b/secord.2002b.pdf
๐Ÿ”— Sweep Line Algorithm: https://en.wikipedia.org/wiki/Sweep_line_algorithm
๐Ÿ”— Lloyd's algorithm: https://en.wikipedia.org/wiki/Lloyd%27s_algorithm
๐Ÿ”— Polygons and meshes by Paul Bourke: https://paulbourke.net/geometry/polygonmesh/
๐ŸŽจ Pablo Jurado Ruiz: https://www.instagram.com/pablojuradoruiz/
๐Ÿ”— Stippling: https://en.wikipedia.org/wiki/Stippling
๐Ÿ”— Voronoi Diagram: https://en.wikipedia.org/wiki/Voronoi_diagram
๐Ÿ”— Delaunay Triangulation: https://en.wikipedia.org/wiki/Delaunay_triangulation
๐Ÿ”— Mike Bostock's Voronoi Stippling: https://observablehq.com/@mbostock/voronoi-stippling

Videos:
๐Ÿš‚ Pixel Array: https://youtu.be/nMUMZ5YRxHI

Related Coding Challenges:
๐Ÿš‚ C4 Worley Noise: https://youtu.be/4066MndcyCk
๐Ÿš‚ 33 Poisson-disc Sampling: https://youtu.be/flQgnCUxHlw

Timestamps:
0:00 Hello!
0:37 What is a Delaunay triangulation?
2:31 d3-delaunay package
2:49 Coding the delaunay triangulation.
6:38 What is a Voronoi diagram?
9:17 voronoi function on the delaunay object
10:25 Things you could try with the Voronoi diagram
10:56 Lloyd's "relaxation" algorithm
12:07 Calculate the average of a polygon's vertices
15:30 Calculate the area of a polygon
16:45 Calculate the proper centroid of a polygon
18:47 What is stippling?
19:45 Draw dots based on brightness value of pixel
21:50 Calculate a weighted centroid
24:51 Using delaunay.find()
27:52 Ideas for you to try!
28:47 Goodbye!

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

๐Ÿš‚ Website: https://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

#delaunaytriangulation #imagestippling #voronoi #sweepalgorithm #lloydsalgorithm #p5js #javascript