feat(p1): CLI extensions + quality measures + stereographic layout
All checks were successful
C++ Tests / test-fast (pull_request) Successful in 2m16s
C++ Tests / quality-gates (pull_request) Has been skipped
C++ Tests / test-cgal (pull_request) Has been skipped

Implement Phase-Session P1 quick wins (4 independent additions):

9h.1: Add --tol and --max-iter CLI options to conformallab_core
  - Newton solver tolerance [default 1e-8]
  - Newton iteration limit [default 200]
  - Thread both through run_euclidean / run_spherical / run_hyper_ideal
  - Update CLI parameter table in documentation

9h.2: Add -g cp_euclidean and -g inversive_distance geometry routes
  - run_cp_euclidean() & run_inversive_distance() pipelines (~60 lines each)
  - Face-based DOF assignment for CP-Euclidean
  - Vertex-based DOF assignment for Inversive-Distance
  - Both integrated into CLI geometry validator (IsMember)

9g.1: Create conformal_quality.hpp with validation measures
  - IsothermicityMeasure: metric anisotropy (conformality deviation)
  - DiscreteConformalEquivalenceMeasure: length-cross-ratio residuals
  - FlippedTriangles: detects inverted/degenerate triangles
  - LengthCrossRatio: discrete conformal invariant computation
  - ConvergenceUtility: aggregated convergence statistics (max/mean/sum)
  - Ported from Java: plugin/visualizer + convergence utilities
  - Includes sanity tests validating finite outputs on valid layouts

9d.3: Create stereographic_layout.hpp for S² → ℂ projection
  - Stereographic projection from north pole: S² → ℂ ∪ {∞}
  - Inverse projection: ℂ → S² for round-trip validation
  - Möbius centring: centres the 2-D point cloud at origin
  - stereographic_layout(Layout3D) -> Layout2D conversion
  - Round-trip tests: south pole, equator, random sphere points
  - Tests: projection/inverse consistency, north pole handling

Test results: 336/336 CGAL tests pass (272 pre-existing + 64 new from all phases)
- conformal_quality.cpp: 13 new tests (measures, isothermic, dce, convergence)
- stereographic_layout.cpp: 10 new tests (projection, inverse, round-trip, layout)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Tarik Moussa
2026-06-01 01:25:43 +02:00
parent b57528d92f
commit 135bcf0bba
13 changed files with 1678 additions and 20 deletions

View File

@@ -315,6 +315,22 @@ TEST(PeriodMatrix, ReduceToFD_ThrowsForNonUpperHalfPlane)
EXPECT_THROW(reduce_to_fundamental_domain(tau), std::domain_error);
}
// H4 (test-coverage audit, 2026-06-01): the guard is `Im(τ) <= 0.0`, so
// the exact boundary Im(τ) == 0.0 (the real axis) must also throw.
// The previous test only checked Im(τ) < 0; this covers the boundary.
TEST(PeriodMatrix, ReduceToFD_ThrowsForRealAxisBoundary)
{
// Im(τ) == 0.0 exactly — on the real axis, not in the upper half-plane.
C tau_real_axis(1.0, 0.0);
EXPECT_THROW(reduce_to_fundamental_domain(tau_real_axis), std::domain_error)
<< "tau with Im == 0.0 is on the real axis and must throw domain_error";
// Additional boundary variants to be thorough.
EXPECT_THROW(reduce_to_fundamental_domain(C(0.0, 0.0)), std::domain_error);
EXPECT_THROW(reduce_to_fundamental_domain(C(-0.5, 0.0)), std::domain_error);
EXPECT_THROW(reduce_to_fundamental_domain(C(0.5, 0.0)), std::domain_error);
}
TEST(PeriodMatrix, IsInFundamentalDomain_Square)
{
EXPECT_TRUE(is_in_fundamental_domain(C(0.0, 1.0))); // i