跳到主要内容

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.001Maximum allowed Euclidean fitting error at the input samples.
max_control_points'Optional[int]'NoneUpper bound for fitted control points. Defaults to the cleaned sample count, with a cubic minimum of four controls.
fairing'float'1e-06Non-negative second-difference regularization weight. Larger values prefer smoother control polygons while still respecting the error tolerance when possible.
duplicate_tolerance'float'1e-12Distance threshold for removing consecutive duplicate sample points before chord-length parameterization.
knot_tolerance'float'1e-09Normalized parameter spacing threshold used to avoid duplicate or near-boundary interior knots.
raise_on_failure'bool'TrueRaise 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 and raise_on_failure=True.

行为与约束

  • 以下契约由当前公共运行时签名生成;所有权与工作流限制见对应领域说明。

导入检查

from cadflow import fit_cubic_bspline_control_points

相关内容