我正在尝试重新创建步骤几何定义的样条曲线(实体“ b_spline_curve_with_knots”),以便以后使用scipy进行评估,知道其度,控制点,,,结和重量。如果需要,我还可以有样条开始和磨练点坐标。我希望这些输入并非所有这些输入都必须针对样条定义。
Scipy中的BSPLINE需要结,样条系数和度。好说,我在这里想念的是样条系数。 是否有一种简单的方法(例如使用Scipy函数)来计算 spline系数,从我拥有的输入中
,如果有人希望我更具体地说:
'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]
]
谢谢。
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.
发布评论
评论(2)
为此,没有Scipy罐头功能。您需要自己实施给定控制点的系数计算。
There is no canned scipy function for this. You'll need to implement the computation of coefficients given control points yourselves.
您可以尝试此python库:
geomdl
python脚本:
ps:
scipy
不支持“ c”曲线,因此请使用geomdl <构造bspline
You can try this python library:
geomdl
python script:
PS:The
scipy
does not support "C" curves, so usegeomdl
to construct BSpline