Posted 01 August 2013 - 08:48 AM
I am trying to get the length of an icbm missile's flight path in order to calculate the flight time:
The missile starts at the launcher position and follows the actual flight path in order to hit the black box (hit point). I have a rather circumstancial function to get the target point in order to hit the hit point (it does not work to aim for the hit point directly because the launchers seem to ignore y-coordinates)
the formula for the above parabola is y = (3 * x * (a + 58) * (a - x)) / (a ^ 2)
to get the arc length, i found the following formula:
but i have absolutely no clue how i would do this in lua
i have a function which returns the flight time for a certain distance so if i had the arc length of both the actual flight path (highlighted green) and the entire parabola, i could just do
and for my function: it basically tries to find the a value for a given y by
an then some fancy math to get targetX and targetY
(full code at http://pastebin.com/UJHXXC60 )
i think this could be done better, but again, i have on clue how i would do it
The missile starts at the launcher position and follows the actual flight path in order to hit the black box (hit point). I have a rather circumstancial function to get the target point in order to hit the hit point (it does not work to aim for the hit point directly because the launchers seem to ignore y-coordinates)
the formula for the above parabola is y = (3 * x * (a + 58) * (a - x)) / (a ^ 2)
to get the arc length, i found the following formula:
but i have absolutely no clue how i would do this in lua
i have a function which returns the flight time for a certain distance so if i had the arc length of both the actual flight path (highlighted green) and the entire parabola, i could just do
local flightTime = (actualPath / fullPath) * getFlightTime( dist )
and for my function: it basically tries to find the a value for a given y by
a = distance
while targetY > parabola(distance, a) do
a = a+1
end
an then some fancy math to get targetX and targetY
(full code at http://pastebin.com/UJHXXC60 )
i think this could be done better, but again, i have on clue how i would do it