3 ms·
One might want something better than a fixed subdivision of the Bezier curves. Anti-Grain Geometry has a good writeup[1] on how to do that. A quick search reve
by magicalhippo 4y ago
One might want something better than a fixed subdivision of the Bezier curves.
Anti-Grain Geometry has a good writeup[1] on how to do that. A quick search revealed a JavaScript library[2] implementing the Anti-Grain solution, for reference.
[1]: http://agg.sourceforge.net/antigrain.com/research/adaptive_bezier/index.html http://agg.sourceforge.net/antigrain.com/research/adaptive_b...
[2]: https://github.com/mattdesl/adaptive-bezier-curve https://github.com/mattdesl/adaptive-bezier-curve
- phkahler 4y ago>> One might want something better than a fixed subdivision of the Bezier curves. In Solvespace we convert them to piecewise linear (PWL) approximations using a chord tolerance setting. If a straight segment deviates from the actual curve by more than the tolerance it is recursively subdivided. C++ code under GPLv3+ for that is available in my favorite file: https://github.com/solvespace/solvespace/blob/f7415048a5769c78fc4bb02afa426d101059374d/src/srf/ratpoly.cpp#L209 https://github.com/solvespace/solvespace/blob/f7415048a5769c...