Direction of Line (I think)
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.