0

I am trying o re-create a spline curve defined in STEP geometry (entity "B_SPLINE_CURVE_WITH_KNOTS") for later evaluation using SciPy, knowing its degree, control points, knots, and weights. If needed,I could also have spline starting and ednding point coordinates. I expect not all of those inputs are mandatory for the spline definition.

Class BSpline in SciPy requires knots, spline coefficients and degree. Obiously, what I miss here are spline coefficients. Is there a simple way (e. g. using SciPy functions) to compute the spline coefficients, from inputs I have?

If someone wanted me to be more speciffic, here are example data:

'knots': [0.0, 0.25, 0.5, 0.75, 1.0],  
'degree': 3,  
'weights': [4.0, 1.0, 1.0, 1.0, 4.0],  
'controlPointsCoords': [ 
[0.0, 37.5, -18.0],  
[0.0, 37.5, -18.11781],  
[0.0, 37.54686, -18.35337],  
[0.0, 37.74703,-18.65297],  
[0.0, 38.04663, -18.85314],  
[0.0, 38.28219, -18.9],  
[0.0, 38.4, -18.9]
]

Thanks.

Oki
  • 7
  • 2

1 Answers1

0

There is no canned scipy function for this. You'll need to implement the computation of coefficients given control points yourselves.

ev-br
  • 24,968
  • 9
  • 65
  • 78
  • Thanks, good to know. Can you push me a little bit in a right direction please? I found this: https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/bspline-curve-coef.html , but I am not sure if this is what I need. I guess this is more like computation of basis functions, than coefficients alone... – Oki Jun 20 '22 at 10:00
  • I start from the Lyche and Morken lecture notes which are referenced in the BSpline docs (but I'm biased, obviously :-)) – ev-br Jun 21 '22 at 13:29