Skip to content

Commit 40da5c3

Browse files
authored
Merge pull request #1451 from CodingTrain/cc-181-stippling
Coding Challenge 181: Weighted Voronoi Stippling
2 parents 0fd881e + 199fb17 commit 40da5c3

File tree

14 files changed

+203
-2
lines changed

14 files changed

+203
-2
lines changed

β€Žcontent/pages/challenges/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"title": "Challenges",
33
"description": "Ready to apply what you’ve learned in the Tracks? Try a Challenge! These one-off project videos build off concepts introduced in Tracks and may have prerequisites (listed on the challenge page itself).",
44
"featuredText": "Featured Challenge:",
5-
"featuredChallenge": "180-falling-sand"
5+
"featuredChallenge": "181-image-stippling"
66
}

β€Žcontent/pages/homepage/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"110-recamans-sequence",
3636
"180-falling-sand",
3737
"143-quicksort",
38-
"134-heart-curve",
38+
"181-image-stippling",
3939
"55-mathematical-rose-patterns"
4040
],
4141
"challengesCta": {
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
{
2+
"title": "Weighted Voronoi Stippling",
3+
"videoNumber": "181",
4+
"description": "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 the d3.js.",
5+
"videoId": "Bxdt6T_1qgc",
6+
"nebulaSlug": "codingtrain-coding-challenge-181-weighted-voronoi-stippling",
7+
"date": "2024-02-22",
8+
"languages": ["p5.js", "JavaScript"],
9+
"topics": ["Delaunay triangulation", "image stippling", "voronoi", "sweep algorithm", "Lloyd's algorithm"],
10+
"canContribute": true,
11+
"relatedChallenges": ["c4-worley-noise", "33-poisson-disc-sampling"],
12+
"timestamps": [
13+
{ "time": "0:00", "title": "Hello!" },
14+
{ "time": "0:37", "title": "What is a delaunay triangulation?" },
15+
{ "time": "2:31", "title": "d3-delaunay package" },
16+
{ "time": "2:49", "title": "Coding the delaunay triangulation." },
17+
{ "time": "6:38", "title": "What is a voronoi diagram?" },
18+
{ "time": "9:17", "title": "voronoi function on the delaunay object" },
19+
{ "time": "10:25", "title": "Things you could try with the Voronoi diagram" },
20+
{ "time": "10:56", "title": "Lloyd's \"relaxation\" algorithm" },
21+
{ "time": "12:07", "title": "Calculate the average of a polygon's vertices" },
22+
{ "time": "15:30", "title": "Calculate the area of a polygon" },
23+
{ "time": "16:45", "title": "Calculate the proper centroid of a polygon" },
24+
{ "time": "18:47", "title": "What is stippling?" },
25+
{ "time": "19:45", "title": "Draw dots based on brightness value of pixel" },
26+
{ "time": "21:50", "title": "Calculate a weighted centroid" },
27+
{ "time": "24:51", "title": "Using delaunay.find()" },
28+
{ "time": "27:52", "title": "Ideas for you to try!" },
29+
{ "time": "28:47", "title": "Goodbye!" }
30+
],
31+
"codeExamples": [
32+
{
33+
"title": "Weighted Voronoi Stippling",
34+
"description": "Implementation of weighted voronoi stippling.",
35+
"image": "gloria_stipple.jpg",
36+
"urls": {
37+
"p5": "https://editor.p5js.org/codingtrain/sketches/AoH40T6fV"
38+
}
39+
},
40+
{
41+
"title": "Circumcircle",
42+
"description": "How to calculate the circumcircle for a triangle.",
43+
"image": "1.jpg",
44+
"urls": {
45+
"p5": "https://editor.p5js.org/codingtrain/sketches/eJnSI84Tw"
46+
}
47+
},
48+
{
49+
"title": "Delaunay Triangulation",
50+
"description": "Visualization the delaunay triangulation with d3-delaunay.",
51+
"image": "triangulation.png",
52+
"urls": {
53+
"p5": "https://editor.p5js.org/codingtrain/sketches/fuQz_-FnA"
54+
}
55+
},
56+
{
57+
"title": "Voronoi Diagram",
58+
"description": "Calculating and drawing the voronoi diagram (with moving points).",
59+
"image": "2.jpg",
60+
"urls": {
61+
"p5": "https://editor.p5js.org/codingtrain/sketches/GpeT1W8X1"
62+
}
63+
},
64+
{
65+
"title": "Voronoi Phyllotaxis",
66+
"description": "Voronoini diagram with seed points calculated by phyllotaxis.",
67+
"image": "3.jpg",
68+
"urls": {
69+
"p5": "https://editor.p5js.org/codingtrain/sketches/ydiZeUK8R"
70+
}
71+
},
72+
{
73+
"title": "Voronoi Diagram colored by area",
74+
"description": "Sketch demonstrating how to map area of a polygon to color.",
75+
"image": "4.jpg",
76+
"urls": {
77+
"p5": "https://editor.p5js.org/codingtrain/sketches/opmU_UQqg"
78+
}
79+
},
80+
{
81+
"title": "Lloyd's relaxation",
82+
"description": "Implementation of Lloyd's relaxation algorithm.",
83+
"image": "lloyd.png",
84+
"urls": {
85+
"p5": "https://editor.p5js.org/codingtrain/sketches/04sgsAcNu"
86+
}
87+
},
88+
{
89+
"title": "Weighted Stippling - Size and Color",
90+
"description": "Stippling with RGB dots and size tied to brightness.",
91+
"image": "size-color.png",
92+
"urls": {
93+
"p5": "https://editor.p5js.org/codingtrain/sketches/_HTZUBPld"
94+
}
95+
},
96+
{
97+
"title": "Weighted Stippling - Abstract Pattern",
98+
"description": "Implementation of weighted stippling on an image generated from perlin noise.",
99+
"image": "5.jpg",
100+
"urls": {
101+
"p5": "https://editor.p5js.org/codingtrain/sketches/9ntWWLXqA"
102+
}
103+
},
104+
{
105+
"title": "Weighted Stippling - video",
106+
"description": "Implementation of applying weighted voronoi stippling algorithm to a moving image.",
107+
"image": "6.png",
108+
"urls": {
109+
"p5": "https://editor.p5js.org/codingtrain/sketches/7TKSgi16z"
110+
}
111+
}
112+
],
113+
"groupLinks": [
114+
{
115+
"title": "References",
116+
"links": [
117+
{
118+
"icon": "πŸ”—",
119+
"title": "d3-delaunay",
120+
"url": "https://d3js.org/d3-delaunay",
121+
"description": "Documentation for d3-delaunay"
122+
},
123+
{
124+
"icon": "πŸ”—",
125+
"title": "Weighted Voronoi Stippling",
126+
"url": "https://www.cs.ubc.ca/labs/imager/tr/2002/secord2002b/secord.2002b.pdf",
127+
"description": "Paper explaining how to generate stipple drawings from grayscale images using weighted centroidal Voronoi diagrams."
128+
},
129+
{
130+
"icon": "πŸ”—",
131+
"title": "Sweep Line Algorithm",
132+
"url": "https://en.wikipedia.org/wiki/Sweep_line_algorithm",
133+
"description": "Wikipedia page about a sweep line or sweep surface algorithm to solve computational geometry problems in Euclidean space."
134+
},
135+
{
136+
"icon": "πŸ”—",
137+
"title": "Lloyd's algorithm",
138+
"url": "https://en.wikipedia.org/wiki/Lloyd%27s_algorithm",
139+
"description": "Wikipedia page discussing Lloyd's algorthm."
140+
},
141+
{
142+
"icon": "πŸ”—",
143+
"title": "Polygons and meshes by Paul Bourke",
144+
"url": "https://paulbourke.net/geometry/polygonmesh/",
145+
"description": "Notes and algorithms dealing with polygons and meshes, includes Calculating the area and centroid of a polygon (1988)"
146+
},
147+
{
148+
"icon": "🎨",
149+
"title": "Pablo Jurado Ruiz",
150+
"url": "https://www.instagram.com/pablojuradoruiz/",
151+
"description": "Artist Pablo Jurado Ruiz's Instagram."
152+
},
153+
{
154+
"icon": "πŸ”—",
155+
"title": "Stippling",
156+
"url": "https://en.wikipedia.org/wiki/Stippling",
157+
"description": "Wikipedia page about the stippling art process."
158+
},
159+
{
160+
"icon": "πŸ”—",
161+
"title": "Voronoi Diagram",
162+
"url": "https://en.wikipedia.org/wiki/Voronoi_diagram",
163+
"description": "Wikipedia page about the Voronoi diagram."
164+
},
165+
{
166+
"icon": "πŸ”—",
167+
"title": "Delaunay Triangulation",
168+
"url": "https://en.wikipedia.org/wiki/Delaunay_triangulation",
169+
"description": "Wikipedia page about the Delaunay triangulation."
170+
},
171+
{
172+
"icon": "πŸ”—",
173+
"title": "Mike Bostock's Voronoi Stippling",
174+
"url": "https://observablehq.com/@mbostock/voronoi-stippling",
175+
"description": "Mike Bostock's observable notebook on voronoi stippling with d3.js."
176+
}
177+
]
178+
},
179+
{
180+
"title": "Videos",
181+
"links": [
182+
{
183+
"icon": "πŸš‚",
184+
"title": "Pixel Array",
185+
"url": "/tracks/pixels/more-p5/pixel-array",
186+
"description": "This video looks at how to access the pixels of an HTML5 canvas in p5.js."
187+
}
188+
]
189+
}
190+
],
191+
"credits": [
192+
{
193+
"title": "Editing",
194+
"name": "Mathieu Blanchette"
195+
},
196+
{
197+
"title": "Animations",
198+
"name": "Jason Heglund"
199+
}
200+
]
201+
}

0 commit comments

Comments
Β (0)