I am using the
geomdl python library to build 3D splines, either by fitting a set of points, with underlaying
B-splines, or directly
NURBS. I need to add constraints. For example, between two control points, I want the spline to fit in a 2D plane I define.
One approach would be to cut the control points list in parts to isolate parts with constraints and then to join the splines. That's divide and conquer. In my example, in the constrained plane, I could use a 2D spline here.
Another approach would be the following, which is only a heuristic and could provide bad results:
- Compute a first 3D fitting spline
- Sample the result
- Check if points don't satisfy the constraints
If there are points not satisfying the constraints:
4.1. Move the k first & k last points inside the constraints for each non compliant segment, k being the spline degree
4.2. Rebuild the control points list from the original one plus these new points
4.3. Compute the spline again
4.4. GOTO 2
The idea of this heuristic, in the case of the 2D plane constraint, is that if for a segment of the control points, k first and last ones are in the plane, along with the control points between, all the points between should be also in the plane.
- What is the math for splines with constraints or wayforward, independently of the python library I use? I have found this article, but too much theoric for what I can do by myself
- If the right method is divide and conquer, what is the math to join the splines? I am sure there are some pitfalls. Is k last control points of the first spline and k first points of the next one identical correct?
geomdlperform it, possibly with some hack? Or another library?