I've created a few trilateration calculators on Desmos - allowing three known points and distances to be used to find the two possible points fulfilling those requirements.
Here's the link to the slim version, without explanation of the methodology.
I hadn't been able to find a freely-available explanation of how to do it, so I figured it would be helpful for me to work it out and put it online. There is a calculator and explanation, though, to be found here, although it's a bit unsatisfying to me. I'd like to see the system of equations solved, and it's also nice to have a visual representation of the points in 3D space.
The gist is that it's a problem of the intersection points of three spheres with known centers and radii. The workings-out of that problem are a bit gnarly when you go directly at it with substitution, so I looked for ways to simplify it. My first approach was the following:
The last two might not be quite so helpful as the first two, but they do make the equations easier to look at and work with.
Notably, it is probably also possible to directly calculate a rotation that would align points two and three to the XY plane AND align point two to the X axis, but it was easier this way. I'm not worrying too much about performance here.
Once the actual calculations are complete, the transformations must all be undone. Thankfully, the only matrix operation I needed to do was a rotation, so I only needed to implement the transpose, as the transpose of a rotation matrix is its inverse.
The only remaining bit of information was that I included some error handling, although in this context it's not strictly necessary - it'll just refuse to calculate and display. If you were trying to implement trilateration in a game, say, or some other real-time application, these could save you some time:
In this method, I realized that, with the advent of the height value that I had initially looked to for error detection, I could calculate the whole cascade of right triangles that the tetrahedron is built out of.
Starting with the height and the lengths of upper edges of the tetrahedron, I can find the distances to the projection of the apex onto the plane of the base.
Once I have those, the distance from the apex's projection to any of the sides of the base can also be found, albeit slightly less directly, along the way also finding the length of the projection of (the apex's projection onto the base) onto the side.
The normal vector of the base and the direction of one of the sides can be crossed to find the perpendicular direction from that edge to the apex's projection, but that second direction could be inverted, so the distance of the resulting points should be checked against the distant corner of the base. The normal vector of the base's direction cannot be resolved, as both directions are valid solutions to the problem.
Once all that's settled, it's a matter of adding up, and the solutions are in hand.
That's basically the whole deal. The results of these two methods are very close, so neither has a considerable loss in precision. If you have to choose between the two, I would recommend the second method, as it requires fewer operations, and no trig functions. If there are errors or edge cases that I haven't accounted for (surely there are), you can let me know and I can try to handle it. I hope this is helpful to somebody!
I also suspect that there's a simpler solution still, not requiring conditional logic, the direct evaluation of the height of the tetrahedron, nor the usual methods of determining the planes of the intersections of the spheres, but I'm not a mathematician and I've got nobody to talk to about this stuff.