feat(phase3c): port SphericalFunctional onto ConformalMesh; update README

New headers:
- spherical_geometry.hpp: spherical arc length l(λ) and half-angle formula
  for interior angles of a spherical triangle (SphericalFaceAngles struct)
- spherical_functional.hpp: SphericalMaps bundle, setup/assign DOF helpers,
  compute_lambda0_from_mesh(), gradient (Θ_v − Σα_v; Schläfli edge formula),
  energy via 10-point Gauss-Legendre path integral, gradient_check_spherical()

Updated:
- mesh_builder.hpp: add make_spherical_tetrahedron() (vertices on unit sphere)
  and make_octahedron_face() (single right-angled spherical triangle)
- tests/cgal/CMakeLists.txt: enable test_spherical_functional.cpp
- README.md: rewrite for CGAL-package goal, two test targets, all headers,
  updated project tree, Phase progress table, key design decisions

Tests (cgal.SphericalFunctional.*): 8 active + 1 skip
- OctaFaceAnglesAreRightAngles, SpherTetAngleSumExceedsPi
- GradientCheck_{OctaFaceVertex, SpherTetVertex, SpherTetAllDofs,
  SpherFan4Vertex, MixedPinnedVertices}
- AnglesFiniteAtKnownPoint
All 30 cgal.* tests pass (2 @Ignore skips).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tarik Moussa
2026-05-12 00:01:24 +02:00
parent 516ac89bd8
commit a4c2a89e7e
6 changed files with 851 additions and 33 deletions

View File

@@ -106,4 +106,44 @@ inline ConformalMesh make_fan(int n)
return mesh;
}
// ── Spherical tetrahedron (vertices on the unit sphere) ───────────────────────
//
// The four vertices of a regular tetrahedron projected onto the unit sphere.
// Starting from (±1,±1,±1), dividing by √3 gives unit-length positions.
// All edge lengths equal arccos(1/3) ≈ 1.9106 radians.
// Used for SphericalFunctional tests (all four faces are valid spherical triangles).
inline ConformalMesh make_spherical_tetrahedron()
{
ConformalMesh mesh;
const double s = 1.0 / std::sqrt(3.0);
auto v0 = mesh.add_vertex(Point3( s, s, s));
auto v1 = mesh.add_vertex(Point3( s, -s, -s));
auto v2 = mesh.add_vertex(Point3(-s, s, -s));
auto v3 = mesh.add_vertex(Point3(-s, -s, s));
mesh.add_face(v0, v2, v1);
mesh.add_face(v0, v1, v3);
mesh.add_face(v0, v3, v2);
mesh.add_face(v1, v2, v3);
return mesh;
}
// ── Octahedron face triangle (vertices on the unit sphere) ────────────────────
//
// One face of a regular octahedron: the triangle (1,0,0)→(0,1,0)→(0,0,1).
// All edge lengths equal arccos(0) = π/2.
// The corner angles are all π/2 (right-angled spherical triangle).
// base log-length: λ° = 2·log(sin(π/4)) = 2·log(1/√2) = log(2) ≈ 0.6931.
inline ConformalMesh make_octahedron_face()
{
ConformalMesh mesh;
auto v0 = mesh.add_vertex(Point3(1, 0, 0));
auto v1 = mesh.add_vertex(Point3(0, 1, 0));
auto v2 = mesh.add_vertex(Point3(0, 0, 1));
mesh.add_face(v0, v1, v2);
return mesh;
}
} // namespace conformallab