Future Position of a Car

This is a discussion on Future Position of a Car within the Game Programming forums, part of the General Programming Boards category; Hi,
Hopefully someone can steer me in the right direction (pardon the pun )
I'm trying to code something from ...

Future Position of a Car

Hopefully someone can steer me in the right direction (pardon the pun )

I'm trying to code something from a paper to get the future position of a car i.e. p(I, Tc + delta t) the position of car I at current time Tc + delta t. Delta t is only one second.

The paper is telling me that I need the following:

v(I,T): motion vector of node I at time T
p(I,T): position vector of node I at time T
with relationship:
p(I,Tc)=p(I,Tr + v(I,Tr)*(Tc-Tr)

The paper then says that the accuracy of the motion vector is vital and says "Let m denote the motion vector accessed from GPS. Mold and Mnew are the reported motion vectors at the last time and this respectively. Mnew = alpha * Mold + (1-alpha)*m, 0<=alpha<=1 with alpha being 0.3 if the car is in a junction and 0.7 otherwise.

Basically I'm confused as to information I need exactly to code this. I have the vehicles current (x,y) position, its old (x,y) position one second ago and can therefore calculate its speed. I don't know how I'm supposed to determine its direction or what form that is supposed to take. I also don't understand the distinction between 'm' in comparison with Mnew and Mold.

Very stuck so any help would be greatly appreciated.
Thanks in advance.

Thats what I thought too. Originally I figured I'd calculate the future position by knowing the old position and the speed and assuming it was moving in a straight line (Not sure if this is very accurate). But then I was wondering if there was a better way of incorporating direction?

Also if they only simply meant for the reader to calculate straight line motion, I don't see what they mean by the equation with the alpha value and the motion vectors?

I'm guessing the bit about alpha is that you want to average out the old reading and the new reading (in terms of position) both for numerical accuracy and stability reasons, but if the car had been at a junction you might expect a sudden sharp change of direction (i.e. a turn), hence the shifting of weights to make the newer direction worth "more" than the older direction.

I have the vehicles current (x,y) position, its old (x,y) position one second ago and can therefore calculate its speed.

Mold and Mnew are the reported motion vectors

Your statements are contradictory. If you know the old position and the new position and old vector and the new vector then you can compute the rest by plugging into the formula. If you only knew the old position and new position then you could subtract them and normalize to find the direction vector. However the problem also gives you the direction vectors. Given that information you can plot a bezier curve which approximates the car's path.

In order to plot the curve you need to interpolate along two line segments over time T. Since vectors are infinite we can create segments from them by using the supplied timeDelta. Essentially if we had motion vector v1 at the old position and we extend it forward into time by 1 second where would it be? You also need to do this for the current motion vector only you need to go back in time by 1 second. Once you have these two vectors you can then pick a sample size and interpolate along v1 and v2 by this coefficient. To find the bezier curve points you create a vector from v1 to v2 and interpolate along it by the same coefficient.

But to find the next position of the car you simply use the formula you have been given and plug and chug. I do not have enough information to solve this because I have not been told if the acceleration throughout this 1 second was constant or non-constant. If it was non-constant then this problem becomes significantly more complex and you need to use a bit of calculus to solve it.

with alpha being 0.3 if the car is in a junction and 0.7 otherwise.

How do you know if the car is in a junction or not? You can determine if this was the case in the previous frame by pluggin in 0.3 and 0.7 into the Mnew formula and comparing the outcome to the vector that was given for the current motion vector. But you have not defined what m is so it will most likely never work without more information.

p(I,Tc)=p(I,Tr + v(I,Tr)*(Tc-Tr)

I'm assuming v(I,Tr) here is the Mnew formula or does it represent the given motion vector at time t = 0? Tc - Tr is essentially timeDelta if I'm reading the formula right. It appears the formula is a simple:

Tr is the previous time
Tc is the current time
v(I,Tr) is the previous motion vector
p(I,Tc) is the current position
Tc - Tr is the time delta
p(I,Tr) is the previous position

Mnew = alpha * Mold + (1-alpha)*m
MNew is the new motion vector
alpha is 0.3 or 0.7
Mold is the previous motion vector
1 - alpha is either 0.7 or 0.3
m is some weight.http://local.wasp.uwa.edu.au/~pbourk...interpolation/
The formula looks like linear interpolation but note that m is an extra variable that is not in any of those interpolation formulas.