refactor: name the tolerances (scad::tol) instead of repeating their numbers
include/scad/core/tolerance.hpp holds 38 constants, each named for what it is a tolerance for, with a how-to-choose comment and a table. 116 sites in 56 files use them; every constant has exactly the value of the literal it replaces, so nothing computes differently (ctest and the golden parity tests unchanged). About 110 literals stay where they are on purpose: OCCT mirror bindings, solver constants that already have local names, relative-times-floor combinations, raster/render epsilons. Six ambiguous sites are listed in the CHANGELOG-free note of the commit for the owner: extrude_until.cpp:68 (1e-8 sine test), :193 (extent below 1e-12 uses kDegenerateNorm), probes.cpp:207,228, bind_surface.cpp:75 (interpolation default 1e-5 vs kSplineInterpolation 1e-6), tracking.hpp:148 (tracked_shell tol), BuildCurves3d at 1e-6 (kernel/curves.cpp:177) and 1e-7 (tracking_lofts.cpp:254). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// defaults (keyword-only where Python is keyword-only), plus the create_* aliases.
|
||||
#include "bindings.hpp"
|
||||
|
||||
#include "scad/core/tolerance.hpp"
|
||||
#include "scad/io/brep_region.hpp"
|
||||
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
@@ -154,13 +155,14 @@ void bind_splines(py::module_& m) {
|
||||
};
|
||||
};
|
||||
m.def("make_interpolated_spline_redge", interpolated(&make_interpolated_spline_redge), py::kw_only(),
|
||||
py::arg("points"), py::arg("periodic") = false, py::arg("tolerance") = 1.0e-6,
|
||||
py::arg("points"), py::arg("periodic") = false, py::arg("tolerance") = tol::kSplineInterpolation,
|
||||
"Interpolate an exact B-spline edge through the supplied points.");
|
||||
m.def("make_interpolated_spline_rwire", interpolated(&make_interpolated_spline_rwire), py::kw_only(),
|
||||
py::arg("points"), py::arg("periodic") = false, py::arg("tolerance") = 1.0e-6,
|
||||
py::arg("points"), py::arg("periodic") = false, py::arg("tolerance") = tol::kSplineInterpolation,
|
||||
"Create a one-edge wire that interpolates the supplied points.");
|
||||
m.def("make_periodic_spline_rwire", &make_periodic_spline_rwire, py::kw_only(), py::arg("points"),
|
||||
py::arg("tolerance") = 1.0e-6, "Create a closed periodic spline wire interpolating the supplied points.");
|
||||
py::arg("tolerance") = tol::kSplineInterpolation,
|
||||
"Create a closed periodic spline wire interpolating the supplied points.");
|
||||
}
|
||||
|
||||
void bind_helix(py::module_& m) {
|
||||
|
||||
Reference in New Issue
Block a user