geometry - How to determinate position of a point with triangulation -
i working on project of localization wireless sensors network. using triangulation method estimate position of wireless sensors, have 2 sensors position known :
a(x1,y1)
and b(x2,y2)
and point want locate c(x,y)
and have distances between points :
ab, ac & bc
how can triangulation ?
put
a := dist(b,c), b := dist(a,c). := (a1,a2), b := (b1,b2), c := (x,y). we have
(x - a1)^2 + (y - a2)^2 = b^2 eq (1) (x - b1)^2 + (y - b2)^2 = a^2 thus:
x^2 -2(a1)x + (a1)^2 + y^2 -2(a2)y + (a2)^2 = b^2 x^2 -2(b1)x + (b1)^2 + y^2 -2(b2)y + (b2)^2 = a^2 now subtract:
(2(b1) - 2(a1))x + (a1)^2 - (b1)^2 + 2((b2) - (a2))y + (a2)^2 - (b2)^2 = b^2 - a^2 solve y:
y = u + vx eq (2) where:
u := ((a1)^2 + (a2)^2 - ((b1)^2 + (b2)^2) + a^2 - b^2)/(2((a2) - (b2))) v := (2((b1) - (a1)))/(2((a2) - (b2))) replace y u + vx in eq 1 above:
(x - a1)^2 + (u + vx - a2)^2 = b^2 rx^2 + sx + t = 0 where:
r := 1 + v^2 s := -2(a1) + 2uv - 2v(a2) t := (a1)^2 + (uˆ2) - 2u(a2) + (a2)^2 - b^2 solve x
x = (-s +/- sqrt(s^2 - 4rt))/(2r) from eq 2:
y = u + vx. alternative approach
let a := dist(b,c) , b := dist(a,c) above , put c := dist(a,b). let theta angle bac, depicted below.

we have
cos(theta) = (b^2 + c^2 - a^2)/(2bc) eq (3) then can derive h , c1 as
h := b * sin(theta) = b * sqrt(1 - cost(theta)^2). c1 := b * cos(theta) so,
d := (d1, d2) = (b - a) * c1 / c + eq (4) where
d1 := (b1 - a1)*c1/c + a1 d2 := (b2 - a2)*c1/c + a2 now can use fact c @ distance h on perpendicular ab intersecting @ d:
c := (d1, d2) +/- ((a2 - b2)*h/c, (b1 - a1)*h/c) where +/- stands 2 possibilities of c being above or below line ac.
or
c = (x, y) where
x := d1 +/- (a2 - b2)*h/c y := d2 +/- (b1 - a1)*h/c example
a = (2,3) - b = (5,4) - = sqrt(5) - b = sqrt(5) compute c:
c := dist(a,b) = 3.16227766016838. from eq (3)
cos(theta) = 0.70710678118655 theta := 0.78539816339745 radians compute h , c1:
h := b * sin(theta) = 1.58113883008419. c1 := b * cos(theta) = 1.58113883008419. from eq (4):
d = (3.5,3.5) now compute c:
c = ((a2 - b2)) * h / c , (b1 - a1) * h / c) + d = (-0.5,1.5) + (3.5,3.5) = (3,5) verify:
dist(a,c) = dist((2,3),(3,5)) = sqrt(1ˆ2 + 2^2) = b (ok) dist(b,c) = dist((5,4),(3,5)) = sqrt(2^2 + 1^2) = (ok)