I'm trying to develop a function in R that will locate a point (A) on a map given distances between that point A and two other points (B and C), for which exact coordinates are known. The problem I'm coming up against is that my approach is sensitive to the shape of the triangle, and thus the number of conditions in my algorithm is higher than I think it needs to be, probably because my middle-school maths aren't good enough, so I'm looking for somebody to be really condescending, tell me how silly I'm being, and help me to a general approach to this problem.
For example, I'm looking for a single algorithm that can place point A in all of these circumstances:
- (x,y): B(1,2); C(4,1), distances: A to B = 6, A to C = 2
- (x,y): B(1,1); C(4,2), distances: A to B = 2, A to C = 3
- (x,y): B(1,1); C(4,1), distances: A to B = 2, A to C = 6
For the record, I'm aware that there are two possible points in space that satisfy these assumptions. I'm happy to have both.
Lastly, I'll point out that while this sounds like homework, it's actually ecological research, albeit performed by somebody apparently underqualified to be doing it.