Honesty, i have lost you at the first part already........ =(
But i will spend some time on this and see if i can get some
understanding of how this all fits together..
Thank you for the effort you put in it is appreciated..
robtillaart:
--update --
Sorry, my first reasoning was far too simplified ==> removed; a retry.You need the distance between the microphones and the two delta T arrival times of the shockwave to do the math.
If you have three points A, B and C.
arrival times of soundwave (in order)
A - T0
B - T1
C - T2The fact that the soundwave arrived at A first defines an area(1) of all points P: d.PA < d.PB and d.PA < d.PC (d.PA = distance PA)
The delta-time AB = T1 - T0 defines a distance d1 = (T1 - T0) /so (so = speed Sound)
The delta-time AC = T2 - T0 defines a distance d2 = (T2 - T0) /sodefine the curve of all points Q: d.QA - d.QB = d1 (.QA = distance QA)
define the curve of all points R: d.RA - d.RC = d2These two curves cross each other in area (1) => the point of impact ==> Q == R.
-- update --
if you knew the time of impact the d.QA, dQB and d.QC would be known, making the math faaaaar simpler as these curves are not trivial - quadratic asymptotic beasts with sqrts in it -Think it is easier to write an approximating algorithm that searches the point.
The fact that point A heard the soundwave first => d.QA < d.QB-- update 2 --
from: - Formula and graph of a hyperbola. How to graph a hyperbola based on its formula
A hyperbola is a set of all points P such that the difference between the distances from P to the foci, F1 and F2, are a constant K
so my "quadratic asymptotic beasts with sqrts in it" can be rewritten as hyperbola with A and B (A & C) as foci.
using the drawing of the webpage above:
Assume A = (0,-c) and B = (0,c) and the constant K = d1 = (T1 - T0) /so. The point (0,-a) where the hyperbola crosses the Y-axis is (0, -d1/2)To determine the foci one uses a^2 + b^2 = c^2 => b^2 = c^2 - a^2 = (d.AB/2)^2 - (d1/2)^2
The formula of the hyperbola becomes : y^2 / (-d1/2)^2 - x^2 / (d.AB/2)^2 - (-d1/2)^2 = 1
Same trick for the points A & C (hint: it is easier to use another reference framework to determine the formula and do a translation afterwards: X -> X-xdelta Y -> Y-ydelta)
TODO: determine intersection points of the two hyperbolas and then your close...
-- update 3 --
intersection points
-- http://www.analyzemath.com/HyperbolaProblems/hyperbola_intersection.htmlDifference with the location problem is that the hyperbola defined by points AB and the one defined by points AC are 'orthogonal' - think of it as the red in the drawing rotated 90 degrees (make a drawing!!) There will be two intersection points and because the soundwave arrived first at A it becomes obvious which one to choose.
The code is left as an exercise ....