fit_cubic_bspline_control_points
类型: 函数
领域: 其他公共符号
推荐导入: from cadflow import fit_cubic_bspline_control_points
签名
def fit_cubic_bspline_control_points(sample_points: 'Sequence[Sequence[float]]', *, tolerance: 'float' = 0.001, max_control_points: 'Optional[int]' = None, fairing: 'float' = 1e-06, duplicate_tolerance: 'float' = 1e-12, knot_tolerance: 'float' = 1e-09, raise_on_failure: 'bool' = True) -> 'BSplineFitResult'
功能说明
fit_cubic_bspline_control_points 是 CadFlow 其他公共符号领域的公共函数。
原始 API 说明
Fit a minimal cubic B-spline control polygon to sampled curve points.
Uses chord-length parameterization, cubic clamped B-spline least squares, second-difference fairing regularization, and adaptive simple knot insertion until the maximum sample error is within tolerance. Only simple interior knots are inserted, so a cubic result remains C2-continuous at every interior knot.
参数
| 名称 | 类型 | 必需 | 默认值 | 源码说明 |
|---|---|---|---|---|
sample_points | 'Sequence[Sequence[float]]' | 是 | - | Ordered 2D or 3D points sampled along the intended curve. Consecutive duplicate points within duplicate_tolerance are ignored. |
tolerance | 'float' | 否 | 0.001 | Maximum allowed Euclidean fitting error at the input samples. |
max_control_points | 'Optional[int]' | 否 | None | Upper bound for fitted control points. Defaults to the cleaned sample count, with a cubic minimum of four controls. |
fairing | 'float' | 否 | 1e-06 | Non-negative second-difference regularization weight. Larger values prefer smoother control polygons while still respecting the error tolerance when possible. |
duplicate_tolerance | 'float' | 否 | 1e-12 | Distance threshold for removing consecutive duplicate sample points before chord-length parameterization. |
knot_tolerance | 'float' | 否 | 1e-09 | Normalized parameter spacing threshold used to avoid duplicate or near-boundary interior knots. |
raise_on_failure | 'bool' | 否 | True | Raise ValueError when the tolerance cannot be reached within max_control_points. If false, return the best non-converged result instead. |
返回值
类型: 'BSplineFitResult'
BSplineFitResult containing cubic degree, control points, a full clamped knot vector, knot multiplicities, sample parameters, and fitting error.
异常
ValueError: If inputs are invalid, or if the tolerance cannot be met andraise_on_failure=True.
行为与约束
- 以下契约由当前公共运行时签名生成;所有权与工作流限制见对应领域说明。
导入检查
from cadflow import fit_cubic_bspline_control_points