Tarik Moussa
|
e7dfaed56c
|
feat(phase7): Java-parity layout — priority BFS, halfedge_uv, Möbius holonomy, period matrix, fundamental domain — 158 tests
Phase 7 adds seven features ported from the original Java ConformalLab:
layout.hpp
- Priority BFS (min-heap on BFS depth) replaces FIFO queue, minimising
trilateration error accumulation from the root face outward.
- MobiusMap struct: T(z)=(az+b)/(cz+d), identity/inverse/compose,
from_three (3×3 complex least-squares fit), apply(Vector2d).
- halfedge_uv[h.idx()] = UV of source(h) in face(h); seam halfedges
carry the virtual unfolded position, enabling proper GPU texture atlases.
- Hyperbolic holonomy stored as MobiusMap per cut edge (SU(1,1) isometry).
- best_root_face: largest 3-D area face, 1.5× interior bonus.
- normalise_euclidean also transforms halfedge_uv (centroid + PCA).
- Face-area-weighted iterative Möbius centering (Fréchet mean, Phase 7).
period_matrix.hpp (new)
- PeriodData: lattice generators ω_i as complex numbers, τ = ω₂/ω₁ ∈ ℍ.
- reduce_to_fundamental_domain: SL(2,ℤ) reduction via alternating S/T steps.
- is_in_fundamental_domain, compute_period_matrix.
- NOTE: Siegel matrix Ω for genus g>1 intentionally deferred.
fundamental_domain.hpp (new)
- FundamentalDomain: CCW parallelogram {0, ω₁, ω₁+ω₂, ω₂} for genus 1.
- edge_identifications, generators stored.
- 4g-polygon boundary-walk for g>1 marked TODO(Phase 8) with full algorithm
outline and literature references.
- tiling_copy / tiling_neighbourhood for universal cover visualisation.
Tests: 121 → 158 (+37 Phase 7 tests covering all new features).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-05-13 07:57:13 +02:00 |
|
Tarik Moussa
|
4fc48b39f0
|
feat(phase6): exact hyperbolic layout, Gauss–Bonnet, cut graph, normalisation — 121 tests
New files:
- gauss_bonnet.hpp: euler_characteristic, genus, Σ(2π-Θ_v) sum/rhs/deficit,
check_gauss_bonnet (throws), enforce_gauss_bonnet (correct sign: Δ=(lhs-rhs)/V)
- cut_graph.hpp: CutGraph struct + compute_cut_graph (tree-cotree, Erickson–Whittlesey
2005); boundary edges correctly excluded from cut set
- test_phase6.cpp: 26 new tests (GaussBonnet ×8, CutGraph ×6, HyperbolicTrilateration
×4, Normalisation ×4 — all pass)
layout.hpp (Phase 6 rewrite):
- detail::trilaterate_hyp: exact Möbius + hyperbolic law of cosines replacing old tanh(d/2)
- detail::center_poincare_disk: Möbius centering for hyperbolic normalisation
- normalise_euclidean: centroid → origin + PCA major-axis rotation
- normalise_hyperbolic: Möbius centering in the Poincaré disk
- normalise_spherical: Rodrigues rotation → north pole
- euclidean_layout / hyper_ideal_layout: optional CutGraph* + HolonomyData* + normalise
Bug fixes caught by new tests:
- gauss_bonnet.hpp: enforce_gauss_bonnet had wrong sign for delta
- cut_graph.hpp: boundary edges were incorrectly marked as cut edges
121 tests pass, 2 skipped (Hessian stubs).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-05-13 01:15:41 +02:00 |
|
Tarik Moussa
|
b7593e3f6d
|
feat(phase5): Layout, CLI, JSON/XML serialisation — 95 tests
Phase 5 complete:
layout.hpp
- euclidean_layout(): BFS unfolding in ℝ² using trilaterate_2d
- spherical_layout(): BFS on S² using trilaterate_sph (spherical law of cosines)
- hyper_ideal_layout(): BFS in Poincaré disk (tanh(d/2) Euclidean approx)
- save_layout_off(): convenience OFF writer for 2-D and 3-D layouts
serialization.hpp
- save/load_result_json(): nlohmann/json; stores DOF vector + uv/pos layout
- save/load_result_xml(): hand-written writer/parser; same schema
conformallab_cli.cpp (rewritten)
- CLI11 interface: -i/-o/-g/-j/-x/-s/-v
- Dispatches to euclidean / spherical / hyper_ideal pipeline
- Runs Newton, computes layout, saves OFF + JSON + XML
examples/example_layout.cpp
- Full round-trip demo: solve → layout → JSON/XML → reload → verify
tests/cgal/test_layout.cpp (8 tests)
- Euclidean_PreservesEdgeLengths, CorrectVertexCount, TriangleIsNonDegenerate
- Spherical_PreservesArcLengths, PositionsOnUnitSphere
- HyperIdeal_SuccessAndFinitePositions
- Serialization.JSON_RoundTrip, XML_RoundTrip
All 95 CGAL tests pass (2 skipped — Hessian stubs unchanged).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-05-13 00:53:47 +02:00 |
|