Find the midpoint between two points on the circle
I want to place a new point in the middle of the two points which are on the circle outline (Arc). I have the coordinates $(x,y)$ of the center of the circle, the two red points and the radius of the circle. I want to find out the coordinates of the midpoint of the Arc. Is there a formula for this ?
Example: I want the midpoint coordinates between the two red lines.
6 Answers
$\begingroup$WLOG, we can let the circle be centered at O(0, 0) with radius = r.
Therefore, the equation of the circle is $x^2 + y^2 = r^2$
M(p, q) is point on this circle implies $p^2 + q^2 = r^2$ ……… (1)
By midpoint formula, $N(r, s) = N(\dfrac {x_1 + x_2}{2}, \dfrac {y_1+ y_2}{2})$
N(r, s) is a point on OK, the line perpendicular to $P_1P_2$. By two-point form, the equation of OK is
$y = \dfrac {y_1 + y_2}{x_1 + x_2}x$
M(p, q) is also a point on OK. Thus,
$q = \dfrac {y_1 + y_2}{x_1 + x_2}p$ ………. (2)
Solving (1) and (2) will give you $p = ± r \dfrac {x_1 + x_2}{\sqrt{(x_1 + x_2)^2 + (y_1 + y_2)^2}}$
The ‘±’ provides two sets of answers for (p of M) and (p’ for M’) as shown.
The corresponding values of q can be found via (2).
Selecting the correct M(p, q) is another story.
$\endgroup$ 4 $\begingroup$The point lies on both the circle and the perpendicular bisector of the segment connecting the points, so the midpoint of the (minor) arc is on the radius through the midpoint of the section.
By translation, we may assume that the circle (which has radius, say, $r$) is centered at $(0, 0)$. Now, the midpoint of that segment is $(x_0, y_0) = \frac{1}{2} (x_1 + x_2, y_1 + y_2)$, and so the midpoint along the arc is
$$\frac{r}{\sqrt{x_0^2 + y_0^2}} (x_0, y_0) \textrm{.}$$
Note that this formula fails when the midpoint is $(0, 0)$, which occurs precisely when the two red points on the circle are antipodal, i.e., when they are end points of a diameter.
$\endgroup$ $\begingroup$You can make a system of two equations and solve for the coordinate values of your new point. One equation is that the distance between your new point and the center equals the radius. (So, you need to know the formula for distance). The other equation is that the distance between your new point and one red point equals the distance between your new point and the other red point.
Setting these equations up and solving them will give you two possible points on opposite sides of the circle. The one closest to your two red points is probably the one you want.
$\endgroup$ $\begingroup$The line perpendicular to $AB$ through $O$ gives you the two solutions. If $O=(0,0)$ (for simplicity), $A=(x_A,y_A)$, $B=(x_B,y_B)$, this line is given by $(x,y)=(t\cdot(y_B-y_A), t\cdot (x_A-x_B))$. You need to pick $t$ such that the distance from $O$ becomes the radius $r$, i.e. $t=\pm\frac{r}{\sqrt{(y_B-y_A)^2+(x_B-x_A)^2}}$.
$\endgroup$ $\begingroup$The solution I use in my program is based on MortenL answer.
- $p1(x, y)$ and $p2(x, y)$ are red points on a circle
- $c(x, y)$ is circle center
- $r$ is circle radius
Middle point $m$ on line $p1$ and $p2$ is given by:
$$ m(x, y) = (\frac{p1.x + p2.x}{2}, \frac{p1.y + p2.y}{2}) $$
Distance between $c$ and $m$ is given by:
$$ dist = \sqrt{(c.x - m.x)^2 + (c.y - m.y)^2} $$
Scale factor is given by:
$$ scale = r / dist $$
Differences between $c$ and $m$ are:
$$ dx = \lvert c.x - m.x \rvert $$
$$ dy = \lvert c.y - m.y \rvert $$
and finally, middle point on circle $p(x, y)$ is given by:
$$ p(x, y) = (c.x + (dx * scale), c.y + (dy * scale)) $$
$\endgroup$ 1 $\begingroup$One method: -Find the linear midpoint between the two points -Find the length of the vector between circle center and this midpoint -Normalize and scale this vector to circle radius
$\endgroup$ 1