rf-geom / ridgeforge Public

Overview/Examples/4. Extracting ridges to a polyline file

worked example 4 of 6

Extracting ridges to a polyline file

RidgeExtractor returns ordered chains, not a loose edge set, so writing them out is a loop over polylines rather than a graph-walk you have to code yourself.

Example 4 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

1840 polylines
  ridge   1122
  valley   683
  boundary   35
longest chain 904 vertices

A chain that changes sign is split at the sign change, so no single polyline is reported as half ridge and half valley.

When it goes wrong

Ten thousand two-edge fragments
A noisy scan without a min_edges filter produces a confetti of tiny chains; raise min_edges until the count is sane.
Smoothed lines drift off the surface
smooth_passes moves the polyline only, never the mesh; after one pass the line no longer lies on the surface and must not feed anything that needs it to.
Boundaries where you did not expect them
Set include_boundary=false if open edges should not appear as RidgeKind::Boundary lines.

Variations

Only strong ridges
Raise min_angle_deg from 35 to pick out just the dominant creases.
Keep junctions whole
Set split_at_junctions=false to let chains run through points where three or more lines meet.

Symbols used here