A Dynamic Programming Approach for Segmenting Digital Planar Curves into Line Segments and Circular Arcs