Unified the codebase language to English throughout. German text appeared in code comments, test file headers, CI step names, and several markdown documents. All natural-language text is now English; proper nouns (Institut für Mathematik, Technische Universität Berlin) are unchanged. Files changed: - .gitea/workflows/cpp-tests.yml — CI step names and job comments - code/include/mesh_utils.hpp — inline comment - code/tests/cgal/CMakeLists.txt — section comment block - code/tests/cgal/test_geometry_utils.cpp — full file header + all test comments - doc/math/references.md — geometry-central section - doc/math/validation.md — Section 9 (geometry-central cross-validation) - doc/roadmap/phases.md — Optional geometry-central track (GC-1/2/3) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
#pragma once
|
|
#include <CGAL/Surface_mesh.h>
|
|
#include <Eigen/Dense>
|
|
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
|
|
|
|
|
|
namespace mesh_utils {
|
|
template <typename Kernel>
|
|
void cgal_to_eigen(CGAL::Surface_mesh<typename Kernel::Point_3>& mesh,
|
|
Eigen::MatrixXd& V, Eigen::MatrixXi& F) {
|
|
|
|
CGAL::Polygon_mesh_processing::triangulate_faces(mesh);
|
|
|
|
V.resize(mesh.num_vertices(), 3);
|
|
F.resize(mesh.num_faces(), 3);
|
|
|
|
for (auto v : mesh.vertices()) {
|
|
auto p = mesh.point(v);
|
|
V.row(v.idx()) << p.x(), p.y(), p.z();
|
|
}
|
|
|
|
Eigen::Index face_idx = 0;
|
|
for (auto f : mesh.faces()) {
|
|
int vertex_count = 0;
|
|
for (auto h : CGAL::halfedges_around_face(mesh.halfedge(f), mesh)) {
|
|
auto v = mesh.target(h);
|
|
F(face_idx, vertex_count) = v.idx();
|
|
++vertex_count;
|
|
}
|
|
face_idx++;
|
|
}
|
|
}
|
|
template <typename Kernel>
|
|
void simple_visualize_mesh(Eigen::MatrixXd& V, Eigen::MatrixXi& F) {
|
|
igl::opengl::glfw::Viewer viewer;
|
|
viewer.data().set_mesh(V, F);
|
|
viewer.launch();
|
|
}
|
|
// Zero-copy map for V (optional)
|
|
template <typename Kernel>
|
|
Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, 3, Eigen::RowMajor>>
|
|
get_vertex_map(CGAL::Surface_mesh<typename Kernel::Point_3>& mesh) {
|
|
auto& points = mesh.points();
|
|
double* data = reinterpret_cast<double*>(&points[0][0]);
|
|
return {data, static_cast<Eigen::Index>(points.size()), 3};
|
|
}
|
|
} // namespace
|