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