I dont know actually in which category this problem fits into.. i assumed this is the correct place.. If not then pls guide me as where to post it..

I have set of points which are connected with a line... This connected line may or may not be straight.. As we all know the first and last points of this connected line is called nodes.. and intermediate points are known as vertices.. Now, i need to redistribute the vertices over this line in such a way that, all the vertices are equally spaced.

I mean, suppose if the user wants the vertices to be redistributed with the spacing of say 10 units.. Here i need to have new set of vertices, having distance between each pair of points(x,y) should be 10.

One way i tried this is to start with the first point of the connected lines, and read each point(x,y) along the line segment and find whether the distance of these two points is 10. If it is 10, then take the new point as your reference point and repeat the process... This method works fine. But for lines of different directions, the distance is not same.. so i dont get equally spaced points. The problem is diagramatically expained in the file attached.. 1 is the first input from the user.. 2 is after redistributing...