Skip to main content

Module remesh

Module remesh 

Source
Expand description

Isotropic remeshing: rewrite a triangle mesh so its edges approach one target length and its vertices approach valence six, while the surface stays on the input.

§Method

The incremental scheme of Botsch and Kobbelt (“A remeshing approach to multiresolution modeling”, SGP 2004), as CGAL’s Polygon_mesh_processing::isotropic_remeshing implements it. With L the target edge length, each iteration runs four passes over a HalfedgeMesh:

  1. split every edge longer than 4/3 L at its midpoint;
  2. collapse every edge shorter than 4/5 L whose collapse creates no edge longer than 4/3 L;
  3. flip edges where that brings the four corners’ valences closer to optimal (6 inside, 4 on a boundary);
  4. move every free vertex towards the area-weighted centroid of its triangles, within its tangent plane, and project it back onto the input surface.

§What is kept

Protected edges are the input’s boundary edges and, unless RemeshOptions::feature_angle is None, every edge whose two faces’ normals differ by more than that angle. A protected edge is never flipped, may be split (its midpoint stays on the edge) and may be collapsed only along itself, removing a vertex its feature line runs straight through. So every protected polyline of the input is kept exactly: its corners stay, bit-identical, and every vertex added on it lies on one of its segments. Vertices on protected edges are not relaxed. The boundary loops, the Euler characteristic and the orientation of the input are therefore preserved.

The protected edges cut the input into patches. A free vertex is projected onto the closest point of its own patch only, so it never crosses a sharp edge.

§What is refused and what is skipped

Input the halfedge structure cannot represent – non-manifold edges or vertices, inconsistent winding, out-of-range or repeated corners – is refused by name, as are non-finite positions, degenerate (zero-area) input triangles, a non-positive target, a feature angle outside [0, pi] and a request whose output would exceed the triangle budget.

Individual edits are skipped, not forced: a collapse, flip or move that would fold a triangle (turn its normal by a right angle or more) or leave it flatter than a height-to-longest-edge ratio of 1e-3, a collapse or flip that would lower the smallest angle of the triangles it rewrites below 15 degrees (when it was above), or an edit that breaks the link condition, does not happen. The result is therefore always a valid, consistently oriented mesh, and RemeshReport states how close it came: the fraction of edges within [4/5 L, 4/3 L], the valence deviation before and after, the smallest angle, and the largest distance of any output vertex from the input surface.

§Deviation from the input

Protected vertices lie on the input exactly (up to the rounding of a midpoint). Free vertices are projected onto the input, so their distance from it is zero up to rounding unless a projection was skipped to avoid a fold; RemeshReport::max_vertex_deviation measures it over every output vertex. Between vertices the output is a chord of the input: on a surface of curvature radius R its distance grows like L^2 / (8 R), the sagitta of an edge of length L. That part is the cost of the requested resolution, not of the algorithm.

§Determinism

Every pass visits elements in id order and every decision is a function of the current mesh; no hash map is iterated. The same input and options give a bit-identical output on every run.

Structs§

RemeshOptions
What to remesh towards.
RemeshReport
What a remeshing did and how close it came to the target.

Enums§

RemeshError
Why a remeshing could not be performed.

Functions§

remesh
Remesh a triangle mesh towards a uniform edge length.