fix(minor): all five MINOR findings — doc, accuracy, and DRY
MINOR-1 (spherical_functional.hpp:426)
Wrong comment said "second derivative < 0 for a convex functional".
The spherical energy is *concave* (NSD Hessian); the monotone-f argument
applies to both convex and concave functionals equally. Comment rewritten
to explain the actual physics: increasing scale increases all angles and
thus reduces Σ G_v.
MINOR-2 (spherical_functional.hpp:494-495)
Forward finite difference O(ε) → central finite difference O(ε²):
old: dft = (sum_Gv(t + fd_eps) - ft) / fd_eps
new: dft = (sum_Gv(t + fd_eps) - sum_Gv(t - fd_eps)) / (2*fd_eps)
Same cost when the extra sum_Gv(t - fd_eps) replaces the cached ft.
MINOR-3 (euclidean_functional.hpp, spherical_functional.hpp,
inversive_distance_functional.hpp)
New header gauss_legendre.hpp centralises the 10-point Gauss-Legendre
nodes and weights (gl10_nodes() / gl10_weights()). The three energy
functions now use the shared accessors instead of duplicated local
static arrays.
MINOR-4 (euclidean_functional.hpp, spherical_functional.hpp,
hyper_ideal_functional.hpp, inversive_distance_functional.hpp)
halfedge_to_index() centralised in conformal_mesh.hpp. All four local
aliases (eucl_hidx, spher_hidx, hidx, id_detail::hidx) now delegate to
it as one-line wrappers; the aliases are kept for now to avoid a larger
call-site churn, clearly documented as thin wrappers.
MINOR-5 (clausen.hpp:33-38)
Added a comment above inits() explaining the intentional off-by-one
return value and how it interacts with csevl() — matching the Java
Clausen.inits() / csevl() contract.
277/277 CGAL + 26/26 pure-math tests pass, 0 failed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Surface_mesh.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace conformallab {
|
||||
@@ -107,4 +108,23 @@ inline auto add_face_properties(ConformalMesh& mesh)
|
||||
return ftype;
|
||||
}
|
||||
|
||||
// ── Half-edge index helper ────────────────────────────────────────────────────
|
||||
//
|
||||
// Convert a Halfedge_index to std::size_t for use as a vector subscript.
|
||||
// Each functional previously duplicated this one-liner under a name like
|
||||
// eucl_hidx / spher_hidx / hidx. Centralised here (MINOR-4 fix).
|
||||
//
|
||||
// Implementation: the double-cast uint32_t → size_t is intentional. CGAL 6.x
|
||||
// Surface_mesh stores half-edge indices internally as 32-bit unsigned integers.
|
||||
// Casting directly to size_t on a 64-bit system would produce the same result
|
||||
// because CGAL index types use non-negative values, but the explicit intermediate
|
||||
// cast documents the assumption and silences spurious sign-conversion warnings.
|
||||
|
||||
/// Convert a `Halfedge_index` to `std::size_t` for vector subscript use.
|
||||
/// Replaces the duplicated `eucl_hidx`, `spher_hidx`, `hidx` helpers.
|
||||
inline std::size_t halfedge_to_index(Halfedge_index h) noexcept
|
||||
{
|
||||
return static_cast<std::size_t>(static_cast<std::uint32_t>(h));
|
||||
}
|
||||
|
||||
} // namespace conformallab
|
||||
|
||||
Reference in New Issue
Block a user