How to find the center path of a surface

I am not in front of this graph but I think that I have simply collected all points and subtracted those from the ends of corridors. It was not straightforward since comparing point coordinates may encounter inaccuracies issues…