# VDE-019: make_box/make_cylinder/make_sphere 不支持位置偏移参数 - **ID**: VDE-019 - **Date**: 2026-07-28 - **Status**: Fixed - **Severity**: Medium - **Category**: API Gap - **Source**: ViewDesign feat/viewdesign-engine branch ## Issue VDE 的基本体 API 仅支持原点为中心的创建,缺少位置偏移参数: ```cpp // VDE 当前 API(仅原点) auto box = vde::brep::make_box(10, 5, 3); // 原点中心 auto sph = vde::brep::make_sphere(5.0); // 原点中心 auto cyl = vde::brep::make_cylinder(2.0, 10.0); // 原点中心,Y 轴 ``` ViewDesign 的 `PrimitiveFactory` 需要任意位置的基本体构建: ```cpp Shape box(double x1, y1, z1, x2, y2, z2); // 任意两点定义的盒子 Shape sphere(double cx, cy, cz, radius); // 任意位置球体 Shape cylinder(double cx, cy, cz, radius, height); // 任意位置圆柱 ``` ## Current Workaround (ViewDesign) 通过 BrepModel → mesh 转换后手动偏移顶点坐标: ```cpp auto model = vde::brep::make_sphere(radius); // 转换为 mesh,然后遍历顶点加偏移 brepToMeshData(model, verts, tris); for (size_t i = 0; i < verts.size(); i += 3) { verts[i] += offX; verts[i+1] += offY; verts[i+2] += offZ; } ``` 此方案是 lossy 的(B-Rep 精度退化为 mesh 精度),但对于基本体生成可接受。 ## Suggested Fix 为 VDE 的 `make_box`/`make_sphere`/`make_cylinder` 添加可选的位置偏移参数: ```cpp BrepModel make_box(double w, double h, double d, const Point3D& center = Point3D(0, 0, 0)); BrepModel make_sphere(double radius, const Point3D& center = Point3D(0, 0, 0)); BrepModel make_cylinder(double radius, double height, const Point3D& center = Point3D(0, 0, 0)); ``` 或者提供 `make_box(double x1, y1, z1, x2, y2, z2)` 两点定义的重载。