0
$\begingroup$

I am using the geomdl python library to build 3D splines, either by fitting a set of points, with underlaying NURBS or 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:

  1. Compute a first 3D fitting spline
  2. Sample the result
  3. Check if points don't satisfy the constraints
  4. 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.

Questions:

  • 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?
  • Can geomdl perform it, possibly with some hack? Or another library?
$\endgroup$
  • $\begingroup$ What do you mean by "fit in a 2D plane" ?? $\endgroup$ – Yves Daoust May 6 at 10:46
  • $\begingroup$ I mean constrained in a 2D plane. In my use case, the whole spline is 3D, but three sub-parts shall be constrained in three different planes $\endgroup$ – lalebarde May 6 at 17:07
  • $\begingroup$ I guess that with enough control points in these planes, a B-spline will do. $\endgroup$ – Yves Daoust May 6 at 18:00
  • $\begingroup$ Yves, I don't have these additional control points and I want the spline algorithm to do its job. That's why I would prefer an algorithm which take into account such constraints $\endgroup$ – lalebarde May 6 at 19:39
  • $\begingroup$ I suppose this is a math question but I think you may actually have as much luck with it on SO $\endgroup$ – Alexander Gruber May 6 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.