refactor(constants): centralize magic constants from functionals (N4/N6 audit)
- Add LOG_EDGE_LENGTH_FLOOR (-30.0) for degenerate edge handling - Add HYPER_IDEAL_SCALE_FLOOR (0.01) for negative-scale clamping - Add ASIN_DOMAIN_GUARD (1.0 - 1e-15) for asin argument bounding - Each constant is documented with rationale and units - Update 4 usage sites: euclidean_functional, hyper_ideal_functional, spherical_functional, spherical_geometry - Add constants.hpp include to hyper_ideal_functional and spherical_functional 282/282 tests pass. Addresses N4 (unnamed magic constants) and N6 (centralize tolerances) from numerical-stability audit. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
// // res.energy, res.gradient
|
||||
|
||||
#include "conformal_mesh.hpp"
|
||||
#include "constants.hpp"
|
||||
#include "hyper_ideal_geometry.hpp"
|
||||
#include "hyper_ideal_utility.hpp"
|
||||
#include <CGAL/boost/graph/iterator.h>
|
||||
@@ -176,9 +177,9 @@ inline FaceAngleOutputs face_angles_from_local_dofs(
|
||||
if (v1b && v2b && a12 < 0.0) a12 = 0.0;
|
||||
if (v2b && v3b && a23 < 0.0) a23 = 0.0;
|
||||
if (v3b && v1b && a31 < 0.0) a31 = 0.0;
|
||||
if (v1b && b1 < 0.0) b1 = 0.01;
|
||||
if (v2b && b2 < 0.0) b2 = 0.01;
|
||||
if (v3b && b3 < 0.0) b3 = 0.01;
|
||||
if (v1b && b1 < 0.0) b1 = HYPER_IDEAL_SCALE_FLOOR;
|
||||
if (v2b && b2 < 0.0) b2 = HYPER_IDEAL_SCALE_FLOOR;
|
||||
if (v3b && b3 < 0.0) b3 = HYPER_IDEAL_SCALE_FLOOR;
|
||||
|
||||
double l12 = lij(b1, b2, a12, v1b, v2b);
|
||||
double l23 = lij(b2, b3, a23, v2b, v3b);
|
||||
|
||||
Reference in New Issue
Block a user