Find a center line of a closed curve

I have a bunch of closed curves in various shapes, they are not totally random but all have a long and short side. Curves basically represent a linear type of buildings.
I would like to derive a central axis trough these shapes(marked in blue). any ideas how to do it?

If I could tell Grasshopper about which segment represents a short end of a building(marked in red), I could then separate the remaining curves and use Tween two curves to find the middle axis, however I have no idea how to do the first step.

The purpose of all this is to generate a gable roofs like these, just for some more complicated perimeter shapes:

file with base lines:
linear (3.3 KB)

Thanks in advance!

thanks @diff-arch for the link, looks like it’s exactly what I need.