-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic knot calculation #3
Comments
Hi, A similar question was asked on #2 , which might answer your question as well. In short: this library just does B-spline interpolation, which takes the control points and knots and interpolates between them. Computing a B-spline curve that passes through some points is B-spline approximation, which takes some points you want the curve to pass through (or pass closely enough by) and computes the control points and knots that define that curve. B-Spline approximation is much more complicated than interpolation, requiring a linear system solve and other approximation techniques. The course slides here on "Global Curve Approximation" discuss it some: http://www.cad.zju.edu.cn/home/zhx/GM/009/00-bsia.pdf As mentioned on #2 scipy provides a method to compute the B-Spline for a set of points: https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.splprep.html . You could use that to try out the process of approximating the curve and handing those control points and knots to this library to interpolate it to see how it all fits together. But to keep this library small, it just does interpolation. |
Oh, thanks for the explanation. Scipy won't work for me. I'm working on a Rust application, it's a font editor. It's also realtime…I need to calculate the cubic Bezier for the B-Spline as user drags a point. Python, especially CPython, won't do for that at all, especially because it means a costly double conversion of the path data in and out of Python land. You wouldn't happen to know a Rust method for doing this, would you? Or do I need to re-implement some C library? Are you open for being commissioned? I'd happily pay you to write this. It'd be a single function: given a |
Gotcha, the project looks cool! I don't know of a B-spline approximation library, but these might be more useful for a font application where you might also want derivatives or other info:
I'm not sure if either of those provides approximation though. Splines are cool, but unfortunately I don't think I'd have the time to add an approximation feature to this library. Your use case though (2D cubic B-Spline) is a lot easier than a general case that I was initially thinking you meant. The stroke-rs library looks pretty actively developed and targets a wider feature set, that author might be interested in adding some approximation support if they don't have it already. |
|
Hello,
I'm wondering why there's not a way for me to just use control points to get a BSpline? Why can't there be some default knot vector?
The text was updated successfully, but these errors were encountered: