       Re: Triangulation Problem

• Subject: [mg2999] Re: [mg2968] Triangulation Problem
• From: penny at edu-suu-scf.sc.suu.edu (Des Penny)
• Date: 19 Jan 1996 11:04:09 -0600
• Approved: usenet@wri.com
• Distribution: local
• Newsgroups: wri.mathgroup
• Organization: Wolfram Research, Inc.
• Sender: mj at wri.com

```>I am looking for the trigonometric / algebreic  formulae one would use
>to triangulate an unknown position, knowing 3 fixed points and the
>respective distances to the unknown point. (make sence?)
>Oh - in 3 dimensional space.
>
>And actually, the reverse operations would be handy too...ie: given a
>known central point, AND 3 other fixed points, how to find the lengths
>of the lines required to meet at that first point, in 3D.
>

Hi David:

I started tinkering about with your problem.  I wasn't able to come up with
a solution but the following ideas might help.

I tried two approaches:

******************************************************************
Method 1:
---------
a={a1,a2,a3};b={b1,b2,b3};c={c1,c2,c3};
p={x,y,z};

(* points a,b,c are given.  p is desired *)

(* We define the following function which gives the magnitude of any vector *)

magnitude[a_List] := Sqrt[a.a]

(* now the distance between two points whose position vectors are
a={a1,a2,a3} and p={x,y,z} are *)

In:  magnitude[p-a]
Out: Sqrt[(-a1 + x)^2 + (-a2 + y)^2 + (-a3 + z)^2]

(* which of course is the standard Cartesian formula for the distance
between two points in 3D.

We now set up our equations for the given distances between p and a, b, c.
Note that da is given and represents the square of the given distance to a.
*)

e1= magnitude[p-a]^2==da;
e2= magnitude[p-b]^2==db;
e3= magnitude[p-c]^2==dc;

(* We then solve these for the unknowns x,y and z: *)

In:  NSolve[{e1,e2,e3},{x,y,z}]
Out: {{x -> 0.33*(a1 + b1 + c1), y -> 0.33*(a2 + b2 + c2), z -> 0.33*(a3 +
b3 + c3)}}

Discussion:
This should yield the result but clearly it does not since it does not
contain the given values of da, db and dc.  It's interesting to note that
the answer given is the centroid of the triangle abc.

Note that Solve hangs up here.

******************************************************************

Method 2:
---------

I tried finding the minimum the following function:

f= (magnitude[p-a]^2 - da) + (magnitude[p-b]^2-db) + (magnitude[p-c]^2-dc)

Clearly the minimum should be at the point where
magnitude[p-a]^2 == da etc.  The minimum value of f should be 0.

Here is the code:

f=magnitude[p-a]^2 - da + magnitude[p-b]^2-db + magnitude[p-c]^2-dc;

e1= D[f,x]==0;
e2= D[f,y]==0;
e3= D[f,z]==0;

Solve[{e1,e2,e3},{x,y,z}]

Out: {{x -> (a1 + b1 + c1)/3, y -> (a2 + b2 + c2)/3, z -> (a3 + b3 + c3)/3}}

Discussion:
This gives the same result as Method 1.  Again there is no mention of da,
db and dc.  Of course, the partial derivatives remove these constant
values.

Of course in general what we are talking about is the intersection of three
spheres centered at a, b, and c.  The intersection of the first two spheres
usually gives a circle.  The intersection of the last sphere with the
circle usually gives two points.  However, it could also give one point or
an infinite number of points.

******************************************************************

>And actually, the reverse operations would be handy too...ie: given a
>known central point, AND 3 other fixed points, how to find the lengths
>of the lines required to meet at that first point, in 3D.

The answer to this question is straightforward.  The lengths of the lines
are just the distances:

magnitude[p-a]
magnitude[p-b]
magnitude[p-c]

Does anyone have ideas as to why these methods don't yield our result?

Cheers,

Des Penny

==========================
Des Penny
Physical Science Dept.
Southern Utah University
Cedar City, UT 84720

VOICE: (Office): (801) 586-7708
(Home)  : (801) 586-2286
FAX:    (801) 865-8051
e-mail: penny at suu.edu
==========================

```

• Prev by Date: Re: Setting parts of matrices
• Next by Date: Re: Setting parts of matrices
• Previous by thread: Re: Triangulation Problem
• Next by thread: Re: Triangulation Problem