position (5,3) at t = 6
position (3,3) at t = 7
familiar w/ parametric equations? (x,y) as a function of time ...
x = 17 - 2t
y = 3
Hi,
I'm not sure if this falls under the category of coordinate geometry or trigonometry. I need to determine the direction an object is moving in order to figure out its future position, Pf. This works for me when the object is moving to the right but I don’t know how to change the formula when it’s moving left (and how to identify when to change the formula). I assume a 2D cartesian space.
So currently this is what I know. An object was at position (1,3) at t=6 and (3,3) at t=7. I need to figure out where the object will be at t=8.
From what I know I can work out the speed is 2m/s (using the distance formula and speed = distance * time).
Angle = inverse tan ((y2-y1)/(x2-x1)) = 0
Vx = speed * cos(Angle) = 2 * cos (0) = 2
Vy = speed * sin(Angle) = 2 * sin (0) = 0
Future X Position Pfx = Vx + Current X Position = 2 + 3 = 5
Future Y Position Pfy = Vy + Current Y Position = 0 + 3 = 3
Pf = (5,3)
All the above is ok. The problem is if I reverse this example and have an object at position (5,3) at t=6 and (3,3) at t=7, clearly I should get an answer of (1,3) at t=8 but according to the above calculations I don’t. Therefore I need some way of incorporating a direction.
Any help appreciated.
The problem is that tangent is not a one-to-one mapping: . In the second example, the angle should be since you are moving left. However, (y2 - y1) / (x2 - x1) is still 0 since y2 = y1, just as when you are moving right. Since is a function, it must return a single value for the argument 0, and it returns 0, not .Angle = inverse tan ((y2-y1)/(x2-x1)) = 0
If you don't need the angle elsewhere, then it is easier to consider x and y coordinates separately. Suppose you have two moments t0 and t1. Then x(t) = x(t0) + (t - t0) * (x(t1) - x(t0)) / (t1 - t0), and similarly for y(t).
From (1, 3) to (3, 3) is a vector of <3- 1, 3- 3>= <2, 0>. Adding that again to (3, 3), we get (3+ 2, 3+ 0)= (5, 3).
From (5,3) to (3, 3) is <3- 5, 3- 3>= <-2, 0>. Adding that again to (3, 3) gives (3-2, 3+ 0)= (1, 3).From what I know I can work out the speed is 2m/s (using the distance formula and speed = distance * time).
Angle = inverse tan ((y2-y1)/(x2-x1)) = 0
Vx = speed * cos(Angle) = 2 * cos (0) = 2
Vy = speed * sin(Angle) = 2 * sin (0) = 0
Future X Position Pfx = Vx + Current X Position = 2 + 3 = 5
Future Y Position Pfy = Vy + Current Y Position = 0 + 3 = 3
Pf = (5,3)
All the above is ok. The problem is if I reverse this example and have an object at position (5,3) at t=6 and (3,3) at t=7, clearly I should get an answer of (1,3) at t=8 but according to the above calculations I don’t. Therefore I need some way of incorporating a direction.
Any help appreciated.