Ideas about the algorithm:
- Input : your two existing points, the number of breaks you want (say N)
- Divide the straight segment into N segments. You should get, with your two already existing points, N+1 points.
- Extract the coordinates of the points you got at the previous step. (say (x0,y0) ; (x1,y1); etc.)
- Create the lines as follow : from (x0,y0) to (x0,y1), from (x0,y1) to (x2,y1), from (x2,y1) to (x2,y3), from (x2,y3) to (x4,y3), etc. (care about the last iteration, must be (xN,yN))
The way you divide your straight segment will truly define the shape of your final line. You can make segments of equal lengths, scaled with a certain ration, etc.
You can do more complicated path, but you must be more specific in what you want as an output. As you stated it, your problem has to many degrees of freedom you can act on.