Here some helper code I wrote because I had a 2d pan-tilt pointing device, but did not know it’s location. But i did have 3 known points and the angles the pointing device reports when facing these points. The trigonometry helper allowed me to triangulate the unkown observer points.
https://github.com/stephanschulz/triangulation/tree/main/trigonometryHelper