Calculate width early enough to use it in subdivision

This still doesn't draw midlines properly, because we need to
implement the "calculate all nearest neighbors" algorithm. But
now we'll have the width data necessary to do that.
Refactor extraction_demo() to shorten it

We moved a couple self-contained(-ish) chunks of code out of the
whole extraction_demo() function into separate functions, to make
the extraction_demo() code easier to read.