straight skeleton by inward offsetting

the straight skeleton is the crease pattern of the roof you get by pushing every edge of a polygon inward at the same speed. each edge stays parallel to itself; each vertex slides along the angle bisector where its two edges meet. when two fronts collide (an edge shrinks to nothing) the collision point is a skeleton node. this page offsets the polygon by small time steps and records where the vertices go — the traced lines are the skeleton. lift each point by the time it was born and you have the roof; the skeleton is its ridge lines.

honest scope: this only handles convex polygons. for a convex polygon the offset never splits, so per-vertex tracking is exactly the straight skeleton. a concave polygon needs split events (a reflex vertex runs into an edge and the polygon tears in two) — that's the hard part of the real algorithm and this page doesn't do it, so concave inputs would give wrong crossing lines. all the presets below are convex on purpose.

skeleton roof ridge