rf-geom / ridgeforge Public

Overview/Examples/2. Cleaning a raw scan in the right order

worked example 2 of 6

Cleaning a raw scan in the right order

Weld, drop degenerates, agree on winding, then close holes - in that order, because each step needs the previous one to have happened first.

Example 2 of six - the program sits on the examples page, and this page takes it from the running end: the console it produces, the Status values that end it early, and the options worth changing.

What it prints

welded 18803 vertices
removed 241 degenerate
removed 7 components
flipped 1122 triangles
closed 5 of 5 loops

Welding comes first because an STL has no shared vertices at all, so without it there is no adjacency for orientation or hole-filling to use.

When it goes wrong

An edge has three or more faces
orient_consistently returns Status::NonManifold: there is no consistent winding, so it refuses rather than guess.
The tolerance is absolute, not scaled
A fixed 1e-5 on a model measured in metres welds everything or nothing; scale it by the bounding-box diagonal as the program does.
A hole is larger than you allow
fill_holes leaves loops longer than max_loop_edges open and reports a lower count; that is not an error.

Variations

Keep speckle
Drop remove_small_components if the small pieces are real detail and not scanner noise.
Tighter welds
A tolerance of exactly zero merges only bit-identical duplicates, which is the correct choice straight after reading an STL.

Symbols used here