Shape extraction for a polygon mesh