Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decompose splines with t flexibly updated
This commit focuses on decomposing a spline into fewer segments by finding an optimal value of t that meets our target tolerance for flatness while ensuring it is at least as large as the maximum distance from the line segment connecting the starting and ending points of the original curve. The approach employs the bisection method to determine the value of t. The idea behind this method is based on the properties of curves. By choosing the point of maximum curvature as the junction between two line segments during curve fitting, we ensure that the curvature of all points on both segments is less than the maximum curvature of the original curve. This strategy guarantees that the two line segments fit the original curve as well as possible. Additionally, the properties of these two segments are such that the slope of the tangent line at all points in one segment is relatively positive compared to the slope of the line connecting the starting and ending points of the original curve, while the slope in the other line segment is relatively negative. Consequently, the point where the tangent line's slope is zero relative to the connecting line results in the maximum distance. This distance is recorded to ensure we maximize it as much as possible. Although this approach requires more computation to decompose the spline into fewer segments, the extra effort is justified for improved fit. I have modified the implementation of font-edit to use fixed-point arithmetic and used it as the evaluation testbed to do experiments as follows: original - Average number of _de_casteljau calls per point: 1.99 original - Average points per character: 18.89 flexibly update - Average number of _de_casteljau calls per point: 4.53 flexibly update - Average points per character: 16.30 See https://keithp.com/blogs/more-iterative-splines/ for details. Close #2
- Loading branch information