feat: GMP 精确算术后端 + 可插拔谓词接口
新增: - include/vde/foundation/exact_predicates_gmp.h: GMP 精确谓词 - orient_2d/3d, in_circle 完全精确(mpq_class 有理数) - 零舍入误差,任意精度 - include/vde/foundation/predicates.h: 统一谓词接口 - Predicates<T> 编译期选择后端 - VDE_USE_GMP=ON → GMP, OFF → 自适应 double - 便捷函数: orient(), in_circle() - cmake/FindGMP.cmake: GMP 查找模块 - CMake: -DVDE_USE_GMP=ON 启用 GMP 精确模式 - AdaptiveDouble 包装器: 统一后端接口 使用: cmake -DVDE_USE_GMP=ON .. # 完全精确模式
This commit is contained in:
@@ -18,3 +18,20 @@ CircleTest in_circle(const Point2D& a, const Point2D& b,
|
||||
const Point2D& c, const Point2D& d);
|
||||
|
||||
} // namespace vde::foundation::exact
|
||||
|
||||
/// Adaptive double-precision predicates (default backend)
|
||||
namespace vde::foundation {
|
||||
struct AdaptiveDouble {
|
||||
static exact::Orientation orient_2d(const Point2D& a, const Point2D& b, const Point2D& c) {
|
||||
return exact::orient_2d(a, b, c);
|
||||
}
|
||||
static exact::Orientation orient_3d(const Point3D& a, const Point3D& b,
|
||||
const Point3D& c, const Point3D& d) {
|
||||
return exact::orient_3d(a, b, c, d);
|
||||
}
|
||||
static exact::CircleTest in_circle(const Point2D& a, const Point2D& b,
|
||||
const Point2D& c, const Point2D& d) {
|
||||
return exact::in_circle(a, b, c, d);
|
||||
}
|
||||
};
|
||||
} // namespace vde::foundation
|
||||
|
||||
Reference in New Issue
Block a user