Search code examples
mathtrilateration

Trilateration Issue


As I know that Trilateration is the process of finding the center of the area of intersection of three spheres. I wrote Trilateration method in c++, I took the equations and it is details from Trilaterationenter in Wikipedia and 2d trilateration

When take an example like the following:

Example_1: p1(5,10), p2(15,10), p3(10,20), and r1 = 9, r2 = 7, r3 = 8, the answer is (11.6, 13.8) which is logical answer.

enter image description here

but when case like the following example, the answer is like a garbage number, I made sure from the calculations but in such case I don't know the reason!

Example_2: p1(53.279999, 67.040001) , p2(45.860001, 57.330002) , p3( 66.370003, 84.169998) , and r1= 5.824241 , r2 = 8.522444 , r3= 28.456253 , the answer is (910813 ,-695906)

enter image description here


Solution

  • Trilateration works for three non-collinear points. Your points look almost collinear, so some denominator in expressions (I cannot see you code :)) has very small value, and solution is absolutely inexact huge-coordinate point.