# Calculate the distance from a point to the surface of a circle at an angle

Given: A circle C with radius R and center (x,y), A point P at (q,r) some distance d away from the circle at its center line, and at a certain height above that center line h, and An angle of displacement a,

Find the distance from the point P to the circle for both cases: when the angle $$a$$ is zero and when the angle $$a$$ is greater than zero.

Looking forward to whatever solution or even advice someone might be able to give me in order to solve this! Thanks in advance!

• For the first problem, $m=d+R-\sqrt{R^2-h^2}$ by drawing a right triangle inside the circle. The second problem would probably be the same thing except using the law of cosines instead of the Pythagorean theorem, except that you don't even know for certain that the elevated line will intersect the circle depending on $\alpha$.
– user694818
Commented Aug 27, 2019 at 3:23
• Not clear. Do you mean you want to compute the distances $m$ and $n$? Note that the distance from $P$ to the circle is the minimum of the distance $PM$ where $M$ is a varying point on the circle. Here it's obviously smaller than both $m$ and $n$ (at the minimum, $M$ is on the line $PO$ where $O$ is the center of the circle). Commented Aug 27, 2019 at 7:07

So, we need to find out the distance $$PA$$ as a function of $$\alpha$$, including the special case $$\alpha =0$$. It is a quite interesting and challenging problem.

Let $$\beta=∠ACB$$ and apply the tangent formula to the right triangle APD,

$$\tan\alpha = \frac{AD}{PD}=\frac{R\sin\beta - h}{R+d-R\cos\beta}$$

Rearrange above equation to express $$\beta$$ in terms of $$\alpha$$,

$$R\sin(\beta+\alpha)=(R+d)\sin\alpha + h\cos\alpha$$

$$\beta = \sin^{-1} u -\alpha \tag{1}$$

where,

$$u = \left(1+\frac{d}{R}\right)\sin\alpha + \frac{h}{R}\cos\alpha \tag{2}$$

Next, apply the cosine formula to the right triangle APD to write the distance $$PA$$ as,

$$PA(\alpha) =\frac{R+d-R\cos\beta}{\cos\alpha}\tag{3}$$

With (1), we evaluate $$R\cos\beta$$ in above expression to get,

$$R\cos\beta = R\sqrt{1-u^2} \cos\alpha + (R+d)\sin^2\alpha + h\cos\alpha\sin\alpha \tag{4}$$

Plug (2) into (4) and then into into (3), we arrive at the following result,

$$PA(\alpha) =(R+d)\cos\alpha -h\sin\alpha - \sqrt{R^2-[ (R+d)\sin\alpha + h\cos\alpha ]^2} \tag{5}$$

As seen, the distance $$PA$$ varies with the angle $$\alpha$$ in a non-trivial way.

Now, consider the special case of $$\alpha = 0$$. The general result (5) then simplifies greatly,

$$PA(0) = R + d -\sqrt{R^2-h^2}$$

• Well, I think this is perfect - can't thank you enough for the assistance. In order to try and validate the equations, I did a few things; one, I set my height h to zero in order to validate an identity case. I also set my angle a to zero as well, as another identity. Finally, I cheated and set the whole thing up in a CAD package and simply measured the line PA within the software - everything matched up near perfectly! Thanks again! Commented Sep 4, 2019 at 3:28
• Glad you like it. I enjoyed solving it and took me a couple of days to perfect the answer. Commented Sep 4, 2019 at 4:02

Shift the axes by $$(-x,-y),$$ so that the negative $$x$$-axis now lies along the line segment of distance $$d$$ and the circle is now centred at the origin. Our fixed point $$P$$ has the coordinates $$(q-x,r-y)=(-d,h).$$ Since the angle $$a$$ of the inclination of the line from $$P$$ to the circle is also given, the line satisfying those conditions has the equation $$y-h=(x+d)\tan a.$$

Finally, let $$Q$$ be a point both on the circle $$x^2+y^2=R^2$$ and on the line. Then we want to find $$\overline{PQ}.$$ We could do this by first finding the intersection $$Q$$ of the line and the circle (solving the system defined), and then applying the euclidean distance formula.

• This at least is simpler than the higher-voted solutions at this time. I wonder why people seem to like it so complicated. Commented Aug 28, 2019 at 12:37

Considering differential relations exaggerated

$$da= \frac{R d\theta \, \cos \theta}{m}$$ Integrate $$a= \frac{R \sin \theta}{m} + c$$ Initial condition $$R \sin\theta = h,\, a=0$$ so that $$m\, a = R \sin\theta -h.$$

One general approach is to extend the line from $$P = (q,r)$$ indefinitely in whatever direction is given. Drop a perpendicular to that line from $$O = (x,y).$$ Suppose the perpendicular intersects the line at $$Q.$$ Compute the distance $$PQ$$ and the distance $$OQ.$$ Given $$OQ$$ and the radius $$R,$$ you can use the Pythagorean Theorem to compute the distance $$BQ$$ between $$Q$$ and the point where the line meets the circle: $$BQ = \sqrt{R^2 - (OQ)^2}.$$ Subtract this from $$PQ$$ and you have the distance to the circle.

There are various ways to find the lengths $$PQ$$ and $$OQ$$ without actually finding the coordinates of $$Q.$$

One way is to set up unit-length vectors parallel and perpendicular to the line through $$P.$$ Take the dot product of the vector $$OP$$ with each of those vectors; the absolute values give you the two distances.

Another way is to compute the angle $$\angle OPQ,$$ which you can do if you know the angle between $$OP$$ and the line marked $$d$$ and you also know the angle $$a.$$ Now you have one of the angles of the right triangle $$\triangle OPQ,$$ and you can use that angle, the known hypotenuse $$OP$$ of that triangle, and some trigonometry to find the two legs $$OQ$$ and $$PQ.$$