# How to find distance between two points in shown diagram.

In figure below P1 is center of circle whose radius is known, say 'r'. Distance of point M from P1,P2 and P3 is known. How to find out length of D (shown in red line).

@EDIT : All distances are in Latitude/Longitude form.

I appreciate any help in this regards.

Thanks.

• It is not clear what the other endpoint of that line is. It's some point on the circle, but which point? You can't answer the question without that information. – Gerry Myerson Aug 1 '13 at 10:14
• @GerryMyerson We are using two different algorithms to calculate distance from point P1. One algorithm defines range. That means my point should be on circle (anywhere but on (not in but on) circle). Second algorithm gives approximate distance. Both algorithm has medium accuracy. We are trying to mix both algorithm. And it is standard practice to mix the both. Now from second algorithm, if I get distance equal to radius of circle, we will accept distance otherwise we need to adjust according to circle's radius. – Pranit Kothari Aug 1 '13 at 10:20
• I'm sorry, I don't understand --- but I maintain that there must be something special about $D$ that you aren't telling us. From the diagram, all we know about $D$ is that it's on the circle, and different points on the circle are at different distances from $M$. – Gerry Myerson Aug 1 '13 at 10:26
• "How to find the length of D..." ...length=the distance from where? – DonAntonio Aug 1 '13 at 10:34
• @GerryMyerson I am not really allowed to tell about D. – Pranit Kothari Aug 1 '13 at 10:36

You know: $DM^2=TD^2+TM^2$, $TM=MP1-r$ and $TD=r\sin(Tp1D)$
$DM^2=r^2 \sin(Tp1D)^2+(MP1-r)^2$ $DM^2=r^2\sin(Tp1D)^2+MP1^2-2rMP1+r^2$
if you need to have a better result than $DM^2=TD^2+TM^2$ you can $DM=\sqrt{(TD^2+TM^2)}+\sqrt{(r^2\sin(Tp1D)^2-TD^2)}$