A Polygonal Line Algorithm for Constructing Principal Curves