2
$\begingroup$

there are a lot of ways to calculate a circle given two points given the formula $(x-k)^2+(y-k)^2=r^2$ on this board. However these are not unique as there are arbitrary many possibilities to draw a circle through two points (with different radius).

I want to add another condition, such that there is only one possible solution. My condition is that one point is the highest point. To sketch my problem, I created an image with R.

Circle

As you can see in this specific image, the center is given for $p_0=(0,0)$ (blue dot, generally unknown), the highest point is given for $p_1=(x_1,y_1)$ (green dot, highest value, known) and another point $p_2=(x_2,y_2)$ (red dot, known value) is given as well. The red and green lines have the length of the desired radius $r$ (unknown) and the gray line is known through points $p_1$ and $p_2$.

So to sum up, I know the two values $p_1$ and $p_2$ and I'm searching for the radius $r$. I thought that the gray line might give me some information utilizing an equal-sided triangle, but so far I had no luck.

So my question is: How can I calculate radius $r$ given two points $p_1$ and $p_2$.

$\endgroup$
  • $\begingroup$ Related: math.stackexchange.com/questions/2247984/… $\endgroup$ – Ethan Bolker Apr 23 '17 at 17:27
  • $\begingroup$ @EthanBolker: It might be related, but I would argue you that the question asked on that thread falls under the first part of my description that I excluded. It can be solved by the formula (also first part), but consider the following in that question: That $C$ is in the center of $AB$ (also valid) and comparing the resulting circle with the given the picture it is not a unique circle anymore. $\endgroup$ – user3079834 Apr 23 '17 at 17:37
1
$\begingroup$

Let $t$ be the angle between the green and the grey line. The length of the grey line is $|p_1p_2|=2r\cos t$.

Using the given coordinates for $p_1$ and $ p_2$ we also have $|p_1p_2|\cos t=(y_1-y_2)$.

We can now solve for $r$ finding $$r={1\over 2}{ |p_1p_2|^2\over (y_1-y_2)}$$ and the coordinates for the centre are $$C=(x_1,y_1-r)$$

$\endgroup$
  • $\begingroup$ I implemented your equation into my algorithm in R and works nicely. Thank you! $\endgroup$ – user3079834 Apr 23 '17 at 17:58
  • $\begingroup$ Happy It helped. $\endgroup$ – N74 Apr 23 '17 at 21:30
1
$\begingroup$

The highest point is directly above the center. The center has to be on the perpendicular bisector of the segment $p_1p_2$ (all points equidistant from $p_1, p_2$ are on the perpendicular bisector, and the center is exactly $r$ away from both).

So the center is the intersection of a vertical line through the highest point and the perpendicular bisector of the segment $p_1p_2$. Then $r$ is easy to calculate.

$\endgroup$
1
$\begingroup$

The highest point lies directly above the center of the circle. So if the center is an unknown $(x,y) $ then the highest point is $(x,y+r)=(x_1,y_1) =p_1$. Or $x=x_1;y=y_1-r $.

So if $p_2=(x_2,y_2) $ then $r=\sqrt {(x_2-x_1)^2+(y_2-y_1+r)^2} $.

Solving we get: ...

====== old answer =======

If $(x,y)$ is the "highest" point then the tangent line to that circle is horizontal and the center of the circle is $(x,y-r) $ (ie the center of the circle lies "directly" below $(x,y) $ a distance of $r$ lower.)

So given the other point is $(u,v) $ we need to solve that $(u-x)^2+(v-y+r)^2= r^2$. (i.e the distance from $(u,v) $ to $(x,y-r) $ is $r$.

===

So $(u-x)^2+(v-y)^2+2r (u-y)+r^2=r^2$

So $r=\frac { (u-x)^2+(v-y)^2 }{2 (y-u)}$

$\endgroup$
  • 1
    $\begingroup$ In the old answer, $(u-y)$ should be $(v-y)$ $\endgroup$ – PM 2Ring Apr 23 '17 at 17:46
  • $\begingroup$ Hey fleablood, your and N74 answers are both right and yours is very nice and detailed! I marked N74 as correct answer, because he answered first and implementing his solution was very fast. However I want to explicitly thank you for describing the steps in detail. $\endgroup$ – user3079834 Apr 23 '17 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.