Polygonal Chain Approximation with Iterative End-Points Fitting