Hi there,

I'm a programmer trying to plot the positions between two points. The number of steps from Point1 to Point2 is variable, as are the x,y positions of the two points.

I can do it if the speed is constant. The function is as follows:

Code:

PlotMotion(x1,y1,x2,y2,steps)
xinc = Beat(x1,x2)-Defeat(x1,x2)
xinc=xinc/(steps-2)
yinc = Beat(y1,y2)-Defeat(y1,y2)
yinc=yinc/(steps-2)
For a = 2 To steps
c(a)\x=Defeat(x1,x2)+(xinc*a)
c(a)\y=Defeat(y1,y2)+(yinc*a)
Next a
c(1)\x=x1
c(1)\y=y1
c(steps)\x=x2
c(steps)\y=y2

That's the program code (PureBasic). Forgive my ignorance but I believe the mathematical formula would be something like:

$\displaystyle Xn = (x2-x1) / steps * n$

$\displaystyle Yn = y2-y1) / steps * n$

assuming that x2 is greater than x1, and y2 is greater than y1.

However, can anyone tell me how to plot the path between two points if **the speed is steadily decelerating**?

At high school I could possibly have done this by myself but that's years ago and I'm reduced to googling for the formula. Hours later, I still can't find it, so any help would be greatly appreciated.

Thanks for reading,

Seymour.