how i can solve this proplem

hi,,,,,,if i want to move shape (ball) in line(using line eaquation) it has start and end point and this line is not straight for example in cline or otheri can make ball move in vertical or horizontal but that situation i need your help with ittank you
[281 byte] By [azsa] at [2007-10-1 14:20:00]
# 1

You could use a parametric equation for the line. Assuming the line goes from P to Q, the equation (L(t)) would look like:

L(t) = P + t * (Q - P) 0 <= t <= 1

The operations here are vector addition and scalar multiplication, so if P=(Px,Py) and Q(Qx,Qy), then the coordinates you move along are:

x(t) = Px + (Qx - Px) * t

y(t) = Py + (Qy - Py) * t

0 <= t <= 1

By changing the value of t from 0 to 1 you get all the points on the line.

shmoove

shmoovea at 2007-7-10 17:50:03 > top of Java-index,Other Topics,Java Game Development...
# 2
thnks i will try it
azsa at 2007-7-10 17:50:03 > top of Java-index,Other Topics,Java Game Development...