Files
ViewDesignEngine/include/vde/foundation/predicates.h
T

42 lines
1.4 KiB
C++
Raw Normal View History

#pragma once
#include "vde/foundation/exact_predicates.h"
#ifdef VDE_USE_GMP
#include "vde/foundation/exact_predicates_gmp.h"
#endif
namespace vde::foundation {
/// Unified predicate interface — selects GMP or adaptive double at compile time
struct Predicates {
#ifdef VDE_USE_GMP
using Backend = exact::GmpExact;
#else
using Backend = exact::AdaptiveDouble;
#endif
static exact::Orientation orient_2d(const Point2D& a, const Point2D& b, const Point2D& c) {
return Backend::orient_2d(a, b, c);
}
static exact::Orientation orient_3d(const Point3D& a, const Point3D& b,
const Point3D& c, const Point3D& d) {
return Backend::orient_3d(a, b, c, d);
}
static exact::CircleTest in_circle(const Point2D& a, const Point2D& b,
const Point2D& c, const Point2D& d) {
return Backend::in_circle(a, b, c, d);
}
};
// ── Convenience wrappers (preferred API) ──
inline exact::Orientation orient(const Point2D& a, const Point2D& b, const Point2D& c) {
return Predicates::orient_2d(a, b, c);
}
inline exact::Orientation orient(const Point3D& a, const Point3D& b, const Point3D& c, const Point3D& d) {
return Predicates::orient_3d(a, b, c, d);
}
inline exact::CircleTest in_circle(const Point2D& a, const Point2D& b, const Point2D& c, const Point2D& d) {
return Predicates::in_circle(a, b, c, d);
}
} // namespace vde::foundation