Files
ViewDesignEngine/docs/reference
hm 6f44d48d29
Build & Test / build-and-test (push) Canceled after 0s
VDE Build & Test / build-and-test (push) Canceled after 0s
Build & Test / python-bindings (push) Canceled after 0s
feat: P2-5c 圆角盒 seam 归零 + P3-4/5/6/7 收口(1.0.68)
### P2-5c 圆角盒残余 seam 96→0
- 根因:平面单环耳切剔除共线中间点,与共享采样 3 段边界不一致;新增 restore_ring_boundary_points 把共享边界点逐点补回;
- 26 面圆角盒 open 96→0(Plane/Cylinder/Sphere 全 0),tris 6396,box 类保持 0;平面面与曲面相邻时 10 tris/面(纯平面 box 仍 2),
  测试断言按新语义更新;

### P3-4 外部服务 OS 级沙箱
- vde-service.json limits(max_memory_mb/max_cpu_seconds/max_processes/kill_on_close);Windows Job Object(挂起创建→Assign→Resume、
  KILL_ON_JOB_CLOSE、内存/CPU/进程数限制事件)+ POSIX setsid/rlimit;结果 limit_exceeded/limit_kind;
- test_plugin_external_service 18/18(内存/CPU/进程数超限、kill_on_close 回收、旧行为、非法清单);docs 更新;

### P3-5 插件 DLL 工件哈希 + 密钥轮换/吊销
- manifest artifacts[{path,sha256}]/key_id;SHA-256 自实现 + 路径白名单;Policy require_artifact_hashes/trusted_keys/revoked_key_ids;
  新错误码;evaluate 扩展 + manager hook 已接线;tool verify --hash/--key-id;test_plugin_security 42/42;docs plugin-security §4.5/§4.6;

### P3-6 C++ 跨 DLL ABI 边界定稿(opt-in 实验)
- VDE_BUILD_CPP_SHARED(默认 OFF)12 内核模块 SHARED + consumer smoke(CPP_SHARED_CONSUMER_PASS faces=6 volume=6000);
- 决策:保持 C++ 静态 + 纯 C ABI + 插件默认;跨 DLL 单例/STL/RTTI/导出规模风险,实验仅 opt-in;architecture §7.8/design §13;

### P3-7 MSVC/Linux 跨平台验证收口
- .github/workflows/ci.yml 新增 windows-msvc job(YAML 校验通过);vde_platform UTF-8 宽 API/error/自守卫修复;
- 可移植性审计 12 类;docs/guides/cross-platform-validation.md;本机无 MSVC/WSL/docker,实机由 CI 反馈;

### VDE-1249 / 工程
- 反馈单更新:圆角盒 open 960→96→0,1.0.68 预算 Normal≈6396,宿主复测指引改 1.0.68;
- 版本 1.0.68;全量构建 0 error(340 targets);全量 ctest 7472 注册、7377/7377 PASS(0 failed,25 skipped,560.68s)。
2026-10-28 20:49:27 +08:00
..

ViewDesignEngine API 参考文档

版本: 1.0.1 | 分支: main | 语言: C++20

📚 文档索引

模块 文档 说明
总览 README.md 本文档,模块索引总览
core api-reference-core.md 核心几何模块:矩阵、变换、基础图元、表达式求解、CAM、平台抽象
brep api-reference-brep.md B-Rep 边界表示模块(60+头文件):建模、阵列、约束、剖面、标注、HLR、视口、捕捉、结构型材
curves api-reference-curves.md 曲线曲面模块:NURBS 曲线/曲面、曲面工具、continuity、offset 等
foundation api-reference-foundation.md 基础 IO 模块:22 种格式的导入导出(glTF/DXF/DWG/STL/JT/Parasolid/ACIS/IFC 等)
mesh api-reference-mesh.md 网格模块:mesh→曲线转换、点云(E57/LAS)、重建与处理
spatial api-reference-spatial.md 空间索引模块:BVH 加速结构、射线查询、KNN、范围查询
C API api-reference-capi.md C 语言边界接口:跨语言 FFI(Python/Rust/C#/JS)
格式支持 format-support.md 22 种 CAD 格式支持表:版本、导入/导出状态、备注
变更日志 changelog.md 近期 API 新增、修改和废弃记录

🏗️ 项目架构

ViewDesignEngine (vde)
├── core/          核心几何与计算
│   ├── 基础数学: Matrix4D, Transform3D, Point, Vector, Plane, Line, Ray
│   ├── 几何图元: AABB, Triangle, Polygon2D, ConvexHull
│   └── 空间计算: Distance, ClosestPoint, ICP, Voronoi
├── brep/          B-Rep 边界表示
│   ├── 核心数据: BrepModel (顶点/边/面/壳/体)
│   ├── 建模: extrude, revolve, sweep, loft, fillet, chamfer, shell
│   ├── 基本体: make_box, cylinder, sphere, cone, torus
│   ├── 齿轮/弹簧: make_spur_gear, helical_gear, spring
│   ├── 型材: I-beam, C-channel, angle, tube, weld_bead
│   ├── 阵列/镜像: linear_pattern, circular_pattern, mirror_body_pattern
│   ├── 布尔: brep_union, intersect, subtract, assembly_boolean
│   ├── 截面/裁剪: section_plane, clip_body, cross_section_extents
│   ├── HLR/标注: hlr_edges, linear_dimension, angular_dimension, radial_dimension
│   ├── 约束: constraint_solver (3D 装配), assembly_constraints
│   └── PMI/MBD: PMI 产品制造信息标注
├── curves/        曲线曲面
│   ├── NURBS: NurbsCurve, NurbsSurface (工厂方法: line/circle/arc/helix/plane/box)
│   ├── Bézier: BezierCurve, BezierSurface
│   ├── B-Spline: BSplineCurve, BSplineSurface
│   ├── 曲面工具: thicken_surface, sew_surfaces, boundary_surface, fill_surface
│   └── 连续性/延伸/编辑: surface_continuity, surface_extension, surface_editing
├── foundation/    IO 格式
│   ├── 网格格式: STL, OBJ, PLY, glTF/GLB, 3MF, VRML, AMF, COLLADA
│   ├── CAD 格式: STEP, IGES, DXF, DWG(原生识别+转换通道+插件), Parasolid XT, ACIS SAT, JT
│   ├── BIM 格式: IFC
│   ├── 点云格式: E57, LAS/LAZ (via PointCloud)
│   └── PDF 3D, STEP AP242 (PMI)
├── mesh/          网格处理
│   ├── HalfedgeMesh (半边数据结构)
│   ├── mesh→curve 桥接: mesh_boundary_to_curve, mesh_contour_to_curves
│   ├── 重建/展开: delaunay_2d, flattening, geodesic_distance
│   ├── 点云: PointCloud (E57/LAS/PLY/PTX 加载,降采样,法线估计)
│   └── 处理: simplify, smooth, repair, parameterize, boolean, marching_cubes
├── spatial/       空间索引
│   ├── BVH: 包围盒层次结构 (SAH 构建,射线/范围/KNN 查询)
│   ├── Octree, KDTree, RTree
│   └── B-Rep 级空间查询: ray_cast_multi, face_adjacency, spatial_index
├── capi/          C 语言接口
│   └── vde_capi.h: 上下文、网格、曲线、约束求解、B-Rep、SDF、Assembly
├── collision/     碰撞检测
│   └── GJK, SAT, Ray-Intersect, Triangle-Intersect
├── boolean/       二维布尔
│   └── boolean_2d, polygon_offset
├── sketch/        草图约束
│   └── constraint_solver (2D 草图)
├── sdf/           有符号距离场
│   └── sdf_primitives, sdf_operations, sdf_to_mesh, sdf_gradient
├── compute/       计算后端 (vde::compute)
│   └── ComputeBackend, CpuSimdComputeBackend, CudaComputeBackend (可选,未启用时回退 CPU SIMD)
└── 独立业务模块(非几何职责,从内核拆分)
    ├── cam/         CAM 加工 (vde::cam): Toolpath, Contour, Pocket, Roughing, Finishing, 5-Axis
    ├── expression/  表达式 (vde::expression): evaluate_expression (参数化设计)
    ├── platform/    平台抽象 (vde::platform): load_library, find_symbol, make_temp_file
    ├── ui/          视口/交互 (vde::ui): viewport_api, gizmo_api, selection_manager
    ├── render/      渲染 (vde::render)
    ├── event/       更新通知 (vde::event)
    ├── drafting/    制图标准 (vde::drafting)
    ├── mechanism/   机构运动 (vde::mechanism)
    ├── pdm/         BOM/物料 (vde::pdm)
    ├── param/       参数管理 (vde::param)
    ├── license/     许可证 (vde::license)
    └── infra/       基础设施 (vde::infra)

🚀 快速开始

基础几何操作

#include <vde/core/point.h>
#include <vde/core/matrix4d.h>
#include <vde/core/transform.h>

using namespace vde::core;

// 矩阵变换
auto T = Matrix4D::Translation(10, 0, 0);
auto R = Matrix4D::RotationZ(M_PI / 4);
auto S = Matrix4D::Scale(2, 2, 2);
Point3D p(1, 2, 3);
Point3D tp = (T * R * S).transform_point(p);

B-Rep 建模

#include <vde/brep/modeling.h>

using namespace vde::brep;

auto box = make_box(10, 5, 3);
auto cylinder = make_cylinder(2, 10);
auto gear = make_spur_gear(2.5, 20, 10, 20.0);
auto spring = make_spring(20, 3, 10, 80, SpringType::Compression);

文件导入导出

#include <vde/foundation/io_gltf.h>
#include <vde/foundation/io_dxf.h>

// glTF 导入
auto result = foundation::import_gltf("model.glb");

// DXF 导入
auto doc = foundation::import_dxf("drawing.dxf");

📝 约定

  • 命名空间: vde::core, vde::brep, vde::curves, vde::foundation, vde::mesh, vde::spatial, vde::boolean, vde::collision, vde::sdf, vde::compute, vde::io, vde::cam, vde::expression, vde::platform, vde::ui, vde::render 等(vde::sketch 已移出公共 API 面,见 VDE-1201)
  • 值语义: 所有建模函数返回新对象,不修改输入
  • 坐标系统: 右手坐标系,Z 轴向上(默认)
  • 角度: 弧度制(除特殊标注外)
  • 容差: 默认 1e-6
  • 返回约定: 无异常时返回有效值,失败时通过 std::optional 或空对象表示