- #1
M Omran
- 2
- 1
Dear all,
I am working on a car-accident prediction model. I found the following equations here that worked in my model. However, I could not figure out how the equations were derived. Could anyone help me in understanding the derivation of the mintime and mindist equations (Steps 3 and 5 below).
1. For each car/object/point, you know the following:
initial x position
speed in x direction
initial y position
speed in y direction
2. For two points a and b then, let's define the following variables:
xa0: initial x position of point A
xat: speed in x direction of point A
ya0: initial y position of point A
yat: speed in y direction of point A
xb0 initial x position of point B
xbt speed in x direction of point B
yb0 initial y position of point B
ybt speed in y direction of point B
3. The distance between to points is given by Pythagoras. By expressing this distance as a function of time (based on the given variables above), then we can solve for the minimum possible distance. If we do this then we get a formula which will give us the time of minimum distance. The result is the following formula:
mintime =
-(xa0*xat - xat*xb0 - (xa0 - xb0)*xbt + ya0*yat - yat*yb0 - (ya0 - yb0)*ybt)
/
(xat^2 - 2*xat*xbt + xbt^2 + yat^2 - 2*yat*ybt + ybt^2)
4. The distance at any time t is given by the following expression:
dist = sqrt((t*xat - t*xbt + xa0 - xb0)^2 + (t*yat - t*ybt + ya0 - yb0)^2)
It depends on the given variables in addition to t.
5. To calculate the minimum distance then, you just evaluate it using the minimum time you calculated previously. So with t = mintime:
mindist = sqrt(
(mintime*xat - mintime*xbt + xa0 - xb0)^2
+
(mintime*yat - mintime*ybt + ya0 - yb0)^2
)
Many thanks in advance
I am working on a car-accident prediction model. I found the following equations here that worked in my model. However, I could not figure out how the equations were derived. Could anyone help me in understanding the derivation of the mintime and mindist equations (Steps 3 and 5 below).
1. For each car/object/point, you know the following:
initial x position
speed in x direction
initial y position
speed in y direction
2. For two points a and b then, let's define the following variables:
xa0: initial x position of point A
xat: speed in x direction of point A
ya0: initial y position of point A
yat: speed in y direction of point A
xb0 initial x position of point B
xbt speed in x direction of point B
yb0 initial y position of point B
ybt speed in y direction of point B
3. The distance between to points is given by Pythagoras. By expressing this distance as a function of time (based on the given variables above), then we can solve for the minimum possible distance. If we do this then we get a formula which will give us the time of minimum distance. The result is the following formula:
mintime =
-(xa0*xat - xat*xb0 - (xa0 - xb0)*xbt + ya0*yat - yat*yb0 - (ya0 - yb0)*ybt)
/
(xat^2 - 2*xat*xbt + xbt^2 + yat^2 - 2*yat*ybt + ybt^2)
4. The distance at any time t is given by the following expression:
dist = sqrt((t*xat - t*xbt + xa0 - xb0)^2 + (t*yat - t*ybt + ya0 - yb0)^2)
It depends on the given variables in addition to t.
5. To calculate the minimum distance then, you just evaluate it using the minimum time you calculated previously. So with t = mintime:
mindist = sqrt(
(mintime*xat - mintime*xbt + xa0 - xb0)^2
+
(mintime*yat - mintime*ybt + ya0 - yb0)^2
)
Many thanks in advance