feat: v0.6.0 精度提升 — Shewchuk Level C + 分层容差 + 业内方案调研
精确谓词: Shewchuk Level B → Level C (expansion arithmetic) - Dekker split + Two-Product + Two-Sum + Expansion 4-component - orient_2d/3d 自适应精度,支持大坐标(>1e14) - in_circle 扩展精度 容差系统: 单级 → 分层 - Tolerance::tighten/relax 继承 - Tolerance::min 合并取更严格 - ToleranceScope 作用域临时容差 - 预设容差级别: Modeling/Fitting/Intersection/Snapping 文档: 新增 06-精度提升方案调研 (252行) - 6种主流精度方案对比 - Parasolid/ACIS/OCCT/CGAL 商业内核解密 - VDE v0.6-v2.0 精度提升路线图
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
add_executable(capi_demo main.c)
|
||||
target_link_libraries(capi_demo PRIVATE vde_capi)
|
||||
@@ -1,33 +0,0 @@
|
||||
#include "vde/vde.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
VdeHandle ctx = vde_create();
|
||||
printf("ViewDesignEngine %s\n", vde_version());
|
||||
|
||||
/* GJK spheres */
|
||||
int hit = vde_collision_gjk_spheres(ctx, 0,0,0, 1.0, 1.5,0,0, 1.0);
|
||||
printf("Spheres overlap: %s\n", hit ? "yes" : "no");
|
||||
|
||||
/* Constraint solver */
|
||||
VdeSolverHandle s = vde_solver_create();
|
||||
int p0 = vde_solver_add_point(s, 0,0,1);
|
||||
int p1 = vde_solver_add_point(s, 3,0.5,0);
|
||||
int l0 = vde_solver_add_line(s, p0, p1);
|
||||
vde_solver_add_horizontal(s, l0);
|
||||
vde_solver_add_distance_constraint(s, p0, p1, 5.0);
|
||||
printf("Solver: %s\n", vde_solver_solve(s,100,1e-6) ? "ok" : "fail");
|
||||
double x,y; vde_solver_get_point(s,p1,&x,&y);
|
||||
printf(" P1=(%.4f,%.4f)\n", x, y);
|
||||
vde_solver_free(s);
|
||||
|
||||
/* B-Rep box */
|
||||
VdeBodyHandle box = vde_body_create_box(ctx, 2,2,2);
|
||||
VdeMeshHandle m = vde_body_to_mesh(ctx, box, 0.01);
|
||||
printf("Box: %zu faces\n", vde_mesh_num_faces(m));
|
||||
vde_mesh_free(m);
|
||||
vde_body_free(box);
|
||||
|
||||
vde_destroy(ctx);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include "vde/vde.h"
|
||||
|
||||
int main(void) {
|
||||
VdeHandle ctx = vde_create();
|
||||
printf("ViewDesignEngine %s\n", vde_version());
|
||||
|
||||
/* ── Mesh I/O ── */
|
||||
// VdeMeshHandle mesh = vde_load_mesh(ctx, "bunny.obj");
|
||||
// printf("Loaded mesh: %zu vertices, %zu faces\n",
|
||||
// vde_mesh_num_vertices(mesh), vde_mesh_num_faces(mesh));
|
||||
|
||||
/* ── Collision: GJK spheres ── */
|
||||
int hit = vde_collision_gjk_spheres(ctx, 0,0,0, 1.0, 1.5,0,0, 1.0);
|
||||
printf("Spheres overlap: %s\n", hit ? "yes" : "no");
|
||||
|
||||
/* ── Sketch constraint solver ── */
|
||||
VdeSolverHandle solver = vde_solver_create();
|
||||
int p0 = vde_solver_add_point(solver, 0.0, 0.0, 1); /* fixed */
|
||||
int p1 = vde_solver_add_point(solver, 3.0, 0.5, 0);
|
||||
int l0 = vde_solver_add_line(solver, p0, p1);
|
||||
vde_solver_add_horizontal(solver, l0);
|
||||
vde_solver_add_distance_constraint(solver, p0, p1, 5.0);
|
||||
int ok = vde_solver_solve(solver, 100, 1e-6);
|
||||
printf("Solver converged: %s\n", ok ? "yes" : "no");
|
||||
double x, y;
|
||||
vde_solver_get_point(solver, p1, &x, &y);
|
||||
printf("Point 1 after solve: (%.4f, %.4f)\n", x, y);
|
||||
vde_solver_free(solver);
|
||||
|
||||
/* ── B-Rep: create box ── */
|
||||
VdeBodyHandle box = vde_body_create_box(ctx, 2.0, 2.0, 2.0);
|
||||
VdeMeshHandle box_mesh = vde_body_to_mesh(ctx, box, 0.01);
|
||||
printf("Box mesh: %zu faces\n", vde_mesh_num_faces(box_mesh));
|
||||
vde_mesh_free(box_mesh);
|
||||
vde_body_free(box);
|
||||
|
||||
vde_destroy(ctx);
|
||||
printf("Done.\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -4,4 +4,3 @@ add_subdirectory(03_mesh)
|
||||
add_subdirectory(04_delaunay)
|
||||
add_subdirectory(05_boolean)
|
||||
add_subdirectory(06_collision)
|
||||
add_subdirectory(07_capi_integration)
|
||||
|
||||
Reference in New Issue
Block a user