2d trilateration

I am writing code to participate in an AI call. The main task of the AI ​​task is to take a simulated robot and lead it through a maze to the destination area. A secondary goal, which is optional, is to find a charger placed in a maze in an unknown place. All this is done in a 2D grid.

My program can call a method to measure the distance from the charger. Thus, using trilateration, I should be able to find the charger by calling this method, recording my current position and the distance the charger is 3 times away from this point.

I found this trilateration example on wikipedia http://en.wikipedia.org/wiki/Trilateration , but this applies to three-dimensional space. I only deal with 2D space. Also, I don’t understand how to use the formula shown on Wikipedia, Internet search for a working example with numbers included and boiling to the final coordinates is not enough for Google search.

I am not a mathematician; I'm just an AI enthusiast.

An explanation and a step-by-step example of how to calculate the problem is what I need, since math is not my forte. Below are some data:

  • Point 1: x = 39, y = 28, distance = 8
  • Point 2: x = 13, y = 39, distance = 11
  • Point 3: x = 16, y = 40, distance = 8

. , .

+5
1

Wikipedia trilateriation (x, y) : e x, i, e y, d, j, x, y. , , , e x= (P2 - P1)/‖P2 - P1‖ :

  • e x, x= (P2 x - P1 x)/sqrt ((P2 x - P1 x) 2 + (P2 y - P1 y) 2)
  • e x, y= (P2 y - P1 y)/sqrt ((P2 x - P1 x) 2 + (P2 y - P1 y) 2)

:

  • P1 = (39, 28); r 1= 8
  • P2 = (13, 39); r 2= 11
  • P3 = (16, 40); r 3= 8

:

  • e x= (P2 - P1)/‖P2 - P1‖
  • = e x (P3 - P1)
  • e y= (P3 - P1 - · e x)/‖P3 - P1 - · e x
  • d = ‖P2 - P1‖
  • j = e y (P3 - P1)
  • x = (r 1 2 - r 2 2 + d 2)/2d
  • y = (r 1 2 - r 3 2 + 2 + j 2)/2j - ix/j
+10

All Articles