I 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.
These 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.
Tangentially 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.
The 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.
12 comments
[ 50.5 ms ] story [ 1064 ms ] threadThe 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
Was this post sparked by the same tweet I saw?: https://twitter.com/cyberia__/status/1432001406899134469?s=2...
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.
[0]: By Hound & Eye, Lost Art Press: https://lostartpress.com/products/by-hound-eye
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/C...
https://www.wikiwand.com/en/Catmull%E2%80%93Clark_subdivisio...
Worth a watch for a quick introduction/recap on how these curves work in the first place (with a focus on gamedev applications).