// Copyright (c) 2024-2026 Tarik Moussa. // SPDX-License-Identifier: MIT // // Package: conformallab++ / Discrete_conformal_map (Phase 8b-Lite, 2026-05-21) /*! \file CGAL/Conformal_layout.h \ingroup PkgConformalMapRef Thin CGAL-style wrapper around the legacy `euclidean_layout()`, `spherical_layout()` and `hyper_ideal_layout()` functions defined in `code/include/layout.hpp`. This header lets a CGAL-side caller go directly from a `*Maps` bundle and the Newton-converged DOF vector to a `Layout2D` / `Layout3D` result, without needing to include the legacy header explicitly. */ #ifndef CGAL_CONFORMAL_LAYOUT_H #define CGAL_CONFORMAL_LAYOUT_H #include #include #include #include "../layout.hpp" namespace CGAL { // ── Re-exported layout types ───────────────────────────────────────────────── // // `Layout2D`, `Layout3D` and `HolonomyData` are defined in // `conformallab::layout` (see `code/include/layout.hpp`). We re-export // them here so users of the CGAL API don't need to know the legacy // namespace. using ::conformallab::Layout2D; using ::conformallab::Layout3D; using ::conformallab::HolonomyData; using ::conformallab::CutGraph; // ── Wrapper functions ──────────────────────────────────────────────────────── /*! \ingroup PkgConformalMapRef Compute the planar Euclidean layout of `mesh` from a converged DOF vector `x` and a `EuclideanMaps` bundle. Optional named parameters: * `cut_graph` (pointer-to `CutGraph`, default `nullptr`) — supply a pre-computed cut graph to get a globally consistent layout on closed meshes. * `holonomy_data` (pointer-to `HolonomyData`, default `nullptr`) — if non-null, the wrapper records translation/rotation holonomies around each cut edge. * `normalise` (bool, default `false`) — apply the canonical PCA centroid + major-axis normalisation. \returns A `Layout2D` with `uv[v]` per vertex. */ template Layout2D euclidean_layout( TriangleMesh& mesh, const std::vector& x, const ::conformallab::EuclideanMaps& maps, const CGAL_NP_CLASS& = parameters::default_values()) { // No CGAL-side named-parameter overrides needed for Phase 8b-Lite: // forward straight to the legacy implementation with sensible // defaults. Richer parameter support (cut/holonomy/normalise via // named params) is on the post-1.0 wishlist; the legacy API can be // called directly in the meantime. return ::conformallab::euclidean_layout(mesh, x, maps); } /*! \ingroup PkgConformalMapRef Compute the spherical layout of `mesh` (points on S² ⊂ ℝ³). */ template Layout3D spherical_layout( TriangleMesh& mesh, const std::vector& x, const ::conformallab::SphericalMaps& maps, const CGAL_NP_CLASS& = parameters::default_values()) { return ::conformallab::spherical_layout(mesh, x, maps); } /*! \ingroup PkgConformalMapRef Compute the hyperbolic layout of `mesh` (Poincaré disk model). */ template Layout2D hyper_ideal_layout( TriangleMesh& mesh, const std::vector& x, const ::conformallab::HyperIdealMaps& maps, const CGAL_NP_CLASS& = parameters::default_values()) { return ::conformallab::hyper_ideal_layout(mesh, x, maps); } } // namespace CGAL #endif // CGAL_CONFORMAL_LAYOUT_H