Triangulation in 3D Space
- by w3b_wizzard
Disclaimer: This is for class, however I'm fresh out of ideas and a nudge in the right direction would be much appreciated. Also, this needs to be implemented in raw C, so no fancy libraries can be used.
I have to write a search and rescue simulator for submarines, it has to find a probe that is randomly placed in 3D space in a grid from of the MAX_XYZ (100000). The only tools I'm given are a "ping" which will give the magnitude of the distance between a certain sub and the probe. The goal is to optimize the costs of this entire operation so a brute force attempt, like looking at every single coordinate, won't work. Hence I was thinking triangulation.
Now, it makes loads of sense to me, place three subs, each one of them uses their ping to get the distance between them and the probe. Since each sub have a known distance relative to one another, it's easy to build the base of a tetrahedron with them, and the results of the ping will point to a certain coordinate, the problem I'm having is how to figure out the elevation, or the height, of the tetrahedron.
So what I have as data is the following:
Distances between subs (In vector format)
Angles between each subs (very easy to compute)
Distance between each sub and the probe (3 segments from the base to the peak)
Angles inside each of the outer 3 surfaces of the tetrahedron.
I tried finding some sort of relationship with the vertices of the tetrahedron and the relative angles in each of them, however all I found had to deal with tetrahedrons built with equilateral triangles, which isn't much help. I have the impression this can be easily solved with trig but either I'm not seeing it or I need more coffee.
Any suggestions would be appreciated!