在Scipy中定义BSPLINE知道其程度,控制点,结和重量

发布于 2025-02-08 19:25:11 字数 704 浏览 1 评论 0 原文

我正在尝试重新创建步骤几何定义的样条曲线(实体“ 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半寸时光 2025-02-15 19:25:11

为此,没有Scipy罐头功能。您需要自己实施给定控制点的系数计算。

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

紫罗兰の梦幻 2025-02-15 19:25:11

您可以尝试此python库: geomdl

> pip install geomdl

python脚本:

curve = BSpline.Curve()
curve.degree = degree
curve.ctrlpts = controlPointsCoords
curve.weights = weights
curve.knotvector = knots
curve.delta = 1 / point_nums
coords = curve.evalpts
print(coords)

ps: scipy 不支持“ c”曲线,因此请使用 geomdl <构造bspline

You can try this python library: geomdl

> pip install geomdl

python script:

curve = BSpline.Curve()
curve.degree = degree
curve.ctrlpts = controlPointsCoords
curve.weights = weights
curve.knotvector = knots
curve.delta = 1 / point_nums
coords = curve.evalpts
print(coords)

PS:The scipy does not support "C" curves, so use geomdl to construct BSpline

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文