-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
Bounding box feature #229
Comments
I will have a look at how to compute the bounding box for B-Splines. |
It looks like there is no general analytical solution for computing the bounding box of a spline of any degree. For splines with degree 3 and less, your approach (converting the spline into a sequence of bezier curves, computing the bounding box of each bezier curve, and merging the bounding boxes into a single bounding box) seems to be the way to go. I could implement a function which applies these steps for spline of degree 3 and less, and falls back to a sampling based approach for spline of higher degree. That said, sampling the spline and computing the bounding box of the resulting polyline (linear search for the minimum and maximum values) could serve as a first quick fix for your issue. |
It looks like that computing the bounding box analytically works only if a spline is function-like, i.e., the control points are monotonically increasing in x. Because TinySpline supports splines of any shape, the provided function will in most cases compute the bounding box numerically, i.e., by sampling the spline with a resolution. |
It seems so. I found an awesome lib for spline, hope it works for you. |
|
Can it support the bounding box function.
For now I use this library to convert the self-defined
spline
tobspline
, then calltoBeziers()
, then get their respective boxes, and then united them.The text was updated successfully, but these errors were encountered: