4 ms·
Chaikin’s Algorithm: Drawing Curves
- tempodox 5y agoThe conceptual simplicity of that algorithm is beautiful.
- AceJohnny2 5y agoAs a side-note, I want to point out the classic Bresentham's Algorithm [1] for drawing straight (non anti-aliased) lines. The cool thing about Bresentham's is you can generalize it to spread out one action (moving on Y) evenly across an input range (moving on X) [1] https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
- andybak 5y agoThat's odd. I've just closed 5 browser tabs on this. Was this post sparked by the same tweet I saw?: https://twitter.com/cyberia__/status/1432001406899134469?s=20 https://twitter.com/cyberia__/status/1432001406899134469?s=2...
- Nevermark 5y agoI like the point distance being 0.2. You get more straight lines in them ... great for railroads. The tracks still follow the general trajectory you want (the terrain?), and pass through the cities (the 0.5 points!), but you get more straight track runs. Straight tracks can be safely traversed at higher speed. :) Also nice for garden paths where a balance between alternating curves and straights is more interesting. Fun tutorial! I also have a bezier library I wrote but had not heard of the Chaikin version.
- Sharlin 5y agoThese look superficially similar to cubic B-splines, except that the spline is always tangent to the line segment between consecutive points where the two intersect, which could be a desirable property.
- jedimastert 5y agoTangentially relevant, but I've been going through a book about compass and straight edge (and sector) constructions in furniture design[0], and there's a section on various curves that can be made with a compass, which essentially involves finding points that can be equidistant between two other points, then using that as the center of a circle, I've been wondering if Bezier curves could fit into such a style. From what I can tell, the methods described in the book ensure that the input points are always on the curve, while with b-splines only the first and last point are. [0]: By Hound & Eye, Lost Art Press: https://lostartpress.com/products/by-hound-eye https://lostartpress.com/products/by-hound-eye
- swayvil 5y agoGood article. Other algorithms like this : SPLIT-TWEAK and JAREK'S TWEAK. Excellent for turning your chunky polygons into curvaceous organicoids. I've used split-tweak a lot with good results. Here's code : https://github.com/johnalexandergreene/Geom_2D/blob/master/CurveSmoother_Closed.java https://github.com/johnalexandergreene/Geom_2D/blob/master/C...
- jedimastert 5y agoIf you take this algorithm (but at 50% w/ 3 points for a cubic spline) you can extend this idea to the third dimension for subdivision surfaces! https://www.wikiwand.com/en/Catmull%E2%80%93Clark_subdivision_surface https://www.wikiwand.com/en/Catmull%E2%80%93Clark_subdivisio...
- ud_0 5y agoFreya Holmer made a very nice visualization of bezier curves by showing the "helper" lines here: https://www.youtube.com/watch?v=aVwxzDHniEw https://www.youtube.com/watch?v=aVwxzDHniEw Worth a watch for a quick introduction/recap on how these curves work in the first place (with a focus on gamedev applications).
- city41 5y agoThe pacing in this article is really nice. Each example is just enough new to not overwhelm, and the deficiency within them is pretty obvious that allows a clean lead into the next talking point to address it. I found this article enjoyable to read.