Calculate position based on angles between three known points

4.2k Views Asked by At

Assume that the positions of three points - A, B and C - are known (arbitrary 2D orthonormal coordinates). Hence it is easy to calculate the sides and angles of the resulting triangle.

The position of the observer, denoted O, is unknown (although on the same plane) but the angles between the points A, B and C are measured by the observer; $ \theta_{AB},\;\theta_{AC},$ and $\theta_{BC} $.

enter image description here

Is it possible to calculate the position of the observer based on this information? According to my intuition the answer is affirmative, however a google search has left me disappointed.

4

There are 4 best solutions below

2
On BEST ANSWER

It's possible. Assuming all measured angles are greater than 0, the following should work for any position of the observer.

Given a line segment AB, the loci of points P such that the angle APB has a constant value are circular arcs that pass through the points A and B. In other words, if you have measured an angle $\theta_{AB}$ between the points $A$ and $B$, your position must be on a particular circular arc passing through $A$ and $B$. This arc can be determined when you know the angle and the position of $A$ and $B$. And when you have $3$ points, you can make $3$ circular arcs and find their common intersection point. That point will be the position of the observer.

Step 1 (AB)

Angle_AB

To find the circular arc passing through $A$ and $B$, first find the bisector of $AB$. Now find the point on the bisector which creates an angle of $\theta_{AB}$ to the cord $AB$. This can be determined using the formula $$h_{AB} = x_{AB}*cot(\frac{\theta_{AB}}{2})$$

Draw a circle through this point and points $A$ and $B$. The observer's position will be on this circle.

Step 2 (BC)

Angle_BC

In the same way as was done above, we find the circular arc passing through $B$ and $C$ (the red circle is the one found above).

We see that the new circle intersects the first circle at point $B$ (not surprising) and at the observer's position. We have now determined the observer's position.

To make absolutely sure, we can do the last circular arc:

Angle_AC

And we have a match.

1
On

Yes, you can. First, make sure your $\theta$ angles are determined by counterclockwise orientation and are between $0$ and $\pi$. Also make sure $$\theta_{AB} + \theta_{BC} + \theta_{CA} = 2 \pi$$ The three circles on the picture intersect at the point you want. These circles are determined by the position of two vertices of the triangle and the corresponding angle $\theta$.

To determine the point $O$ it is enough to construct only two of the three circles. The third one is guaranteed to pass through $O$ as well if and only if $$\theta_{AB} + \theta_{BC} + \theta_{CA} = 2 \pi$$ So basically, given say $\theta_{CA}$ and $\theta_{AB}$, as well as the positions of the points $A, B, C$, you can determine the coordinates of $O$ as the solution to a system of quadratic equations for the two circles, circle $k_{CA}$ with center $O_{CA}$ and radius $AO_{CA}$ and circle $k_{AB}$ with center $O_{AB}$ and radius $AO_{AB}$.

To determine circle $k_{AB}$ for instance, you need to find the position of point $O_{AB}$ and find the length of $AO_{AB}$. Notice that triangle $ABO_{AB}$ as well as triangle $CAO_{CA}$ are isosceles, the points $M_{AB}$ and $M_{CA}$ are the orthogonal projections of the centers $O_{AB}$ and $O_{CA}$ on the edges $AB$ and $CA$ respectively and as such $M_{AB}$ and $M_{CA}$ are the midpoints of the edges $AB$ and $CA$ respectively. Angles $\angle \, O_{AB}AB = \theta_{AB} - \frac{\pi}{2}$ and $\angle \, O_{CA}AC = \theta_{CA} - \frac{\pi}{2}$. Hence in the right angled triangle $M_{AB}AO_{AB}$ you can find $$M_{AB}O_{AB} = \frac{1}{2}AB \tan\left(\theta_{AB} - \frac{\pi}{2}\right)$$ $$AO_{AB} =\frac{AB}{2 \,\cos\left(\theta_{AB} - \frac{\pi}{2}\right)}$$

Analogously

$$M_{CA}O_{CA} = \frac{1}{2}CA \tan\left(\theta_{CA} - \frac{\pi}{2}\right)$$ $$AO_{CA} =\frac{CA}{2 \,\cos\left(\theta_{CA} - \frac{\pi}{2}\right)}$$ This determines the locations of the centers $O_{AB}$ and $O_{CA}$ and $AO_{CA}$ and $AO_{AB}$ are the radii of the corresponding circles $k_{AB}$ and $k_{CA}$. The point $O$ is the first intersection point of circles $k_{AB}$ and $k_{CA}$. Have in mind the second one is $A$ so you know it.

enter image description here

3
On

Once again thank you for the answers. I have written a script in R that generates the circles that you have demonstrated (only for two sides of the triangle though). Perhaps it can be of use.

Output

In the case illustrated above (observer_angel_AB=pi*4/6 and observer_angel_AC= pi*1/3) the observer is located at the upper-right intersection.

Below you will find the code. It should work for any coordinates and angles.

####Determine position of observer - identify (visually) the right intersection between circles

####Clear all vars
rm(list=ls()) 

####Define known points A, B, C
x_coords<- c(10,34,16)
y_coords<- c(10,3,18)

####Observed angels
observer_angel_AB<- pi*4/6
observer_angel_AC<- pi*1/3
####observer_angel_BC<- pi

####Calculate "observer_angel_AB" and "observer_angel_AB" if missing and possible
if (exists("observer_angel_BC")==TRUE)  {
  if (exists("observer_angel_AB")==FALSE) {
    observer_angel_AB<- 2*pi - observer_angel_AC - observer_angel_BC
  }
  if (exists("observer_angel_AC")==FALSE) {
    observer_angel_AC<- 2*pi - observer_angel_AB - observer_angel_BC
  }
}

####Calculate length two sides of triangle
length_AB<- sqrt((x_coords[2]-x_coords[2])^2+(y_coords[2]-y_coords[2])^2) 
length_AC<- sqrt((x_coords[3]-x_coords[2])^2+(y_coords[3]-y_coords[2])^2) 

####Shift such that A i located at (0;0)
coords_A<- matrix(c(x_coords-x_coords[2],y_coords-y_coords[2]),nrow=2,byrow=TRUE) 

####Create matrices for transformation and change basis
P_AB<- cbind(coords_A[,2],matrix(c(0,1,-1,0),ncol=2)%*%coords_A[,2,drop=FALSE])/length_AB 
P_AC<- cbind(coords_A[,3],matrix(c(0,1,-1,0),ncol=2)%*%coords_A[,3,drop=FALSE])/length_AC 

coords_AB<- solve(P_AB)%*%coords_A 
coords_AC<- solve(P_AC)%*%coords_A 

####Calculate points in new orthogonal basis AB
peri_coords_AB<- c(length_AB/2,length_AB/2*tan(pi/2-observer_angel_AB/2))
center_coords_AB<- c(peri_coords_AB[2],peri_coords_AB[2]/2-peri_coords_AB[2]^2/peri_coords_AB[2]/2)
center_coords_AB<- cbind(center_coords_AB, c(center_coords_AB[2], -center_coords_AB[2]))
radius_AB<- sum(center_coords_AB[,1]*center_coords_AB[,1])^.5

####Calculate points in new orthogonal basis AC
peri_coords_AC<- c(length_AC/2,length_AC/2*tan(pi/2-observer_angel_AC/2))
center_coords_AC<- c(peri_coords_AC[2],peri_coords_AC[2]/2-peri_coords_AC[2]^2/peri_coords_AC[2]/2)
center_coords_AC<- cbind(center_coords_AC, c(center_coords_AC[2], -center_coords_AC[2]))
radius_AC<- sum(center_coords_AC[,1]*center_coords_AC[,1])^.5

####Transform points back to orthonormal basis
center_coords_A<- cbind(P_AB%*%center_coords_AB,P_AC%*%center_coords_AC)
center_coords<- center_coords_A+c(x_coords[2],y_coords[2])

####Create plot
plot(x_coords,y_coords,asp=1,pch=19,cex=1.2,main="Determine position of observer:\nIdentify the right intersection between the circles",
     xlim=c(min(x_coords,center_coords[1,])-sd(x_coords)/2,max(x_coords,center_coords[1,])+sd(x_coords)/2),
     ylim=c(min(y_coords,center_coords[2,])-sd(y_coords)/2,max(y_coords,center_coords[2,])+sd(y_coords)/2))
text(x_coords,y=y_coords+sd(y_coords/6),labels = c("A","B","C"))
points(x=center_coords[1,],y=center_coords[2,])
text(x=center_coords[1,],y=center_coords[2,]+sd(y_coords/15),paste0("(",round(center_coords[1,],2)," ; ",round(center_coords[2,],2),")"),cex=.7)

####Draw circles
require(plotrix)
draw.circle(x=center_coords[1,1],y=center_coords[2,1],r=radius_AB,border="peru")
draw.circle(x=center_coords[1,2],y=center_coords[2,2],r=radius_AB,border="seagreen")
draw.circle(x=center_coords[1,3],y=center_coords[2,3],r=radius_AC,border="peru")
draw.circle(x=center_coords[1,4],y=center_coords[2,4],r=radius_AC,border="seagreen")
0
On

I think you can get the position of O from the barycentric coordinates

$$ O = w_A A + w_B B + w_C C $$

where $w_A+w_B+w_C=1$

To get the barycentric coefficients $(w_A,w_B,w_C)$ you examine the ratio of areas of the sub-triangles defined by O

First, the area of the ABC triangle is found by

$$ {\rm area}_{ABC} = \tfrac{1}{2} \| A \times B + B \times C + C \times A \|$$

and for example, the area of the sub-triangle designated by $\theta_{BC}$ is

$$ c = \tfrac{1}{2} | OC | | OB | \sin \theta_{BC}$$

so in summary

$$ \begin{aligned} w_A = \frac{ {\rm area}_{OBC} }{ {\rm area}_{ABC} } & = \frac{ |OB| |OC| \sin \theta_{BC}}{ 2 {\rm area}_{ABC}} \\ w_B = \frac{ {\rm area}_{AOC} }{ {\rm area}_{ABC} } & = \frac{ |OA| |OC| \sin \theta_{AC}}{ 2 {\rm area}_{ABC}} \\ w_C = \frac{ {\rm area}_{ABO} }{ {\rm area}_{ABC} } & = \frac{ |OB| |OA| \sin \theta_{AB}}{ 2 {\rm area}_{ABC}} \end{aligned} $$

and

$$ O = w_A A + w_B B + w_C C $$