Skip to content

Tetrahedral remeshing: Give up on a flip as soon as its angles stop improving - #9592

Open
IasonManolas wants to merge 1 commit into
CGAL:mainfrom
IasonManolas:mr/flip-early-exit-angle-plateau
Open

Tetrahedral remeshing: Give up on a flip as soon as its angles stop improving#9592
IasonManolas wants to merge 1 commit into
CGAL:mainfrom
IasonManolas:mr/flip-early-exit-angle-plateau

Conversation

@IasonManolas

@IasonManolas IasonManolas commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

find_best_flip_to_improve_dh() searches, for each candidate flip vertex, over the cells the
flip would produce, tracking the worst dihedral-angle cosine seen so far. A vertex is only kept
if that worst angle is better than the edge's current worst angle. The search does not stop once
a candidate can no longer win: it keeps scanning the remaining cells and comparing angles that
can only make its worst-case value grow, never shrink.

Once the re running worst angle for a candidate vertexaches the edge's current worst angle, that
vertex is already disqualified (worse case can only stay the same or grow from there), so the
loop can stop scanning it right there instead of finishing the remaining cells. The same pattern
appears twice: once for each of the two symmetric flip-direction loops in this function.

The well-oriented/inverted-cells exception is preserved: for a candidate whose cells are inverted
(not well-oriented), the running worst angle is not a valid signal to reject on, so the early exit
only fires when is_sliver_well_oriented is true.

Testing

Verdict equivalence. The early exit stops scanning a vertex only after it is already
guaranteed to be rejected by the existing "is this vertex worth keeping" test, so it changes when
the loop stops, not what any candidate's outcome is. Full test suite (all executables in
test/Tetrahedral_remeshing) passes.

Byte-identical output, against plain cgal/main:

mesh tets byte-identical
bear ~40K YES
bunny00 ~225K YES
101556.mesh (Thingi10K) 3,521,237 YES

Performance. perf stat -e instructions, Linux, Release, sequential, against plain
cgal/main.

mesh iterations cgal/main instr this PR Δ instr
bear 10 67.04 G 63.35 G -5.52%
bunny00 10 148.80 G 139.60 G -6.19%
101556.mesh 3 2441.29 G 2368.41 G -2.99%

Release Management

  • Affected package(s): Tetrahedral_remeshing
  • License and copyright ownership: unchanged

…mproving

find_best_flip_to_improve_dh() tracks the worst dihedral-angle cosine
seen so far for a candidate flip vertex, and only keeps the vertex if
that worst angle beats the edge's current one. The running worst angle
only ever grows as more cells are scanned, so once it reaches the
edge's current worst angle the vertex is already disqualified and the
remaining cells don't need scanning. The early exit is skipped when
the edge's cells are inverted, since that path accepts the candidate
regardless of the angle comparison.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants