feedback: VDE-476 - NurbsCurve lacks convenience constructor (points-only) for simple CAM contour/pocket toolpath generation

This commit is contained in:
hm
2026-08-04 12:59:25 +08:00
parent 1bb7caf045
commit b6076f93d5
+38
View File
@@ -0,0 +1,38 @@
# VDE-476: NurbsCurve 缺少便捷构造函数 (points-only)
**日期**: 2026-08-04
**严重度**: Low — API 可用性改进
**状态**: Open
---
## 问题描述
`NurbsCurve` 目前只有两个构造函数:
```cpp
NurbsCurve(); // degenerate empty curve
NurbsCurve(std::vector<Point3D> control_points, std::vector<double> knots,
std::vector<double> weights, int degree);
```
对于简单用例(如从点云创建插值曲线或折线),调用方需要手动构造 knots、weights 和 degree 参数。这在 CAM 轮廓工具路径生成等场景中不必要地增加了复杂度。
## 影响
- ViewDesign 的 `offsetContour()`、`contourToolpath()`、`pocketToolpath()` 暂时无法使用 VDE 后端(需要使用 NurbsCurve)
- 其他需要简单点→曲线转换的场景也需要额外代码
## 建议修复
添加便捷构造函数:
```cpp
/// 从控制点创建 degree=1 (polyline) 的 NURBS 曲线
/// knots 自动生成为 clamped: [0,0,1,2,...,n-1,n,n]
/// weights 默认为全 1
explicit NurbsCurve(const std::vector<Point3D>& control_points, int degree = 1);
/// 从控制点创建插值 NURBS 曲线(degree=3 cubic)
static NurbsCurve interpolate(const std::vector<Point3D>& points, int degree = 3);
```