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.
There is no canned scipy function for this. You'll need to implement the computation of coefficients given control points yourselves.