How about something like this? It starts with a circle 1/3 of the way through the curve, then switches to a line 1/3 of the way, then switches to a circle the last 1/3. Shouldn't be too difficult to modify for different curves and distances.
Edit: Just saw what you posted after posting this. The calcualtions in my previous example can be greatly reduced if you are only going to be following a path allong verticle or horizontal endpoints.
SuperStrict Graphics 800,600 Type TPoint Field x:Float Field y:Float End Type Local Point1:TPoint = New TPoint Point1.x = 50 Point1.y = 300 Local Point2:TPoint = New TPoint Point2.x = 750 Point2.y = 300 Local Dist:Float = (Point2.x-Point1.x)/3.0 For Local t:Float = 0 To 1 Step .01 Local Point:TPoint = New TPoint If t < 1/3.0 'first edge Local a:Float = 180.0-90.0*(t*3) Point.x = Cos(a)*Dist+Dist+Point1.x Point.y = Sin(a)*Dist+300 Else If t < 2/3.0 'bottom Point.x = (Point2.x-Point1.x)*t+Point1.x Point.y = Dist+Point1.y Else Local a:Float = 90.0*((1.0-t)*3) Point.x = Cos(a)*Dist-Dist+Point2.x Point.y = Sin(a)*dist+300 End If DrawOval Point.x-5,point.y-5,10,10 Next Flip WaitKey()
Edit: Just saw what you posted after posting this. The calcualtions in my previous example can be greatly reduced if you are only going to be following a path allong verticle or horizontal endpoints.