Coding Challenge 181: Weighted Voronoi Stippling
The Coding Train The Coding Train
1.68M subscribers
144,343 views
0

 Published On Feb 22, 2024

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...

šŸš€ Watch this video ad-free on Nebula https://nebula.tv/videos/codingtrain-...

p5.js Web Editor Sketches:
šŸ•¹ļø Weighted Voronoi Stippling: https://editor.p5js.org/codingtrain/s...
šŸ•¹ļø Circumcircle: https://editor.p5js.org/codingtrain/s...
šŸ•¹ļø Delaunay Triangulation: https://editor.p5js.org/codingtrain/s...
šŸ•¹ļø Voronoi Diagram: https://editor.p5js.org/codingtrain/s...
šŸ•¹ļø Voronoi Phyllotaxis: https://editor.p5js.org/codingtrain/s...
šŸ•¹ļø Voronoi Diagram colored by area: https://editor.p5js.org/codingtrain/s...
šŸ•¹ļø Lloyd's relaxation: https://editor.p5js.org/codingtrain/s...
šŸ•¹ļø Weighted Stippling - Size and Color: https://editor.p5js.org/codingtrain/s...
šŸ•¹ļø Weighted Stippling - Abstract Pattern: https://editor.p5js.org/codingtrain/s...
šŸ•¹ļø Weighted Stippling - Video: https://editor.p5js.org/codingtrain/s...

šŸŽ„ Previous: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ 180:Ā FallingĀ SandĀ Ā 
šŸŽ„ All: Ā Ā Ā ā€¢Ā CodingĀ ChallengesĀ Ā 

References:
šŸ”— d3-delaunay: https://d3js.org/d3-delaunay
šŸ”— Weighted Voronoi Stippling: https://www.cs.ubc.ca/labs/imager/tr/...
šŸ”— Sweep Line Algorithm: https://en.wikipedia.org/wiki/Sweep_l...
šŸ”— Lloyd's algorithm: https://en.wikipedia.org/wiki/Lloyd%2...
šŸ”— Polygons and meshes by Paul Bourke: https://paulbourke.net/geometry/polyg...
šŸŽØ Pablo Jurado Ruiz: Ā Ā /Ā pablojuradoruizĀ Ā 
šŸ”— Stippling: https://en.wikipedia.org/wiki/Stippling
šŸ”— Voronoi Diagram: https://en.wikipedia.org/wiki/Voronoi...
šŸ”— Delaunay Triangulation: https://en.wikipedia.org/wiki/Delauna...
šŸ”— Mike Bostock's Voronoi Stippling: https://observablehq.com/@mbostock/vo...

Videos:
šŸš‚ Pixel Array: Ā Ā Ā ā€¢Ā 11.3:Ā TheĀ PixelĀ ArrayĀ -Ā p5.jsĀ TutorialĀ Ā 

Related Coding Challenges:
šŸš‚ C4 Worley Noise: Ā Ā Ā ā€¢Ā CodingĀ WorleyĀ NoiseĀ Ā 
šŸš‚ 33 Poisson-disc Sampling: Ā Ā Ā ā€¢Ā CodingĀ ChallengeĀ #33:Ā Poisson-discĀ Sa...Ā Ā 

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/pas...
šŸš© Suggest Topics: https://github.com/CodingTrain/Sugges...
šŸ’” GitHub: https://github.com/CodingTrain
šŸ’¬ Discord: https://thecodingtrain.com/discord
šŸ’– Membership: http://youtube.com/thecodingtrain/join
šŸ›’ Store: https://standard.tv/codingtrain
šŸ–‹ļø Twitter: Ā Ā /Ā thecodingtrainĀ Ā 
šŸ“ø Instagram: Ā Ā /Ā the.coding.trainĀ Ā 

šŸŽ„ Coding Challenges: Ā Ā Ā ā€¢Ā CodingĀ ChallengesĀ Ā 
šŸŽ„ Intro to Programming: Ā Ā Ā ā€¢Ā StartĀ learningĀ here!Ā Ā 

šŸ”— 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-o...

This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecod...

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

show more

Share/Embed