wrote and tested piecewise polyline_make_x_common