How to get an ordered list of coordinates of a curve?