2d trilateration

前端 未结 1 398
傲寒
傲寒 2020-12-08 17:44

I am writing some code to participate in an AI challenge. The main objective for the AI challenge is to take a simulated robot and navigate it through a maze to a destinatio

相关标签:
1条回答
  • 2020-12-08 18:39

    As the Wikipedia trilateriation article describes, you compute (x,y) coordinates by successively calculating: ex, i, ey, d, j, x, y. You have to be familiar with vector notation, so, for example, ex = (P2 - P1) / ‖P2 - P1‖ means:

    • ex,x = (P2x - P1x) / sqrt((P2x - P1x)2 + (P2y - P1y)2)
    • ex,y = (P2y - P1y) / sqrt((P2x - P1x)2 + (P2y - P1y)2)

    Your data is:

    • P1 = (39, 28); r1 = 8
    • P2 = (13, 39); r2 = 11
    • P3 = (16, 40); r3 = 8

    The calculation steps are:

    1. ex = (P2 - P1) / ‖P2 - P1‖
    2. i = ex(P3 - P1)
    3. ey = (P3 - P1 - i · ex) / ‖P3 - P1 - i · ex
    4. d = ‖P2 - P1‖
    5. j = ey(P3 - P1)
    6. x = (r12 - r22 + d2) / 2d
    7. y = (r12 - r32 + i2 + j2) / 2j - ix / j
    0 讨论(0)
提交回复
热议问题