Given 3 points A, B and C
How can I find and arc that begins at A, ends at C and pass through B; its center's coordinates, radius and angles for r and r' ?
Given 3 points A, B and C
How can I find and arc that begins at A, ends at C and pass through B; its center's coordinates, radius and angles for r and r' ?
There are a few ways to do this. Here is one algorithm:
Get your COORDS
A = {xA,yA}
B = {xB,yB}
C = {xC,yC}
d = {xd,yd}
Calculate Mid-points of lines AB and BC
mid_AB = { (xA+xB)/2, (yA+yB)/2 }
mid_BC = { (xB+xC)/2, (yB+yC)/2 }
Find slopes of lines AB and BC
slope_AB = (yB-yA)/(xB-xA)
slope_BC = (yC-yB)/(xC-xB)
Construct lines running through mid-points PERPENDICULAR to AB and BC (thank you to Yves for catching the negative!)
Slope_perp_AB = -(slope_AB)^(-1)
Slope_perp_BC = -(slope_BC)^(-1)
*** Line with Slope_perp_AB runs through mid_AB
*** Line with Slope_perp_BC runs through mid_BC
Set the two equations equal to each other and solve to find intersection! This gives you point d={xd,yd} !!!
Calculating the radius and angles is now trivial with the center-point d!
The center of the circle is equidistant to the three given points:
(X-Xa)^2+(Y-Ya)^2 = (X-Xb)^2+(Y-Yb)^2 = (X-Xc)^2+(Y-Yc)^2
Subtracting the first member from the second and the third, we get after regrouping:
2(Xa-Xb) X + 2(Ya-Yb) Y + Xb^2+Yb^2-Xa^2-Ya^2 = 0
2(Xa-Xc) X + 2(Ya-Yc) Y + Xc^2+Yc^2-Xa^2-Ya^2 = 0
This linear system of two equations in two unknowns is easy to solve with Cramer's rule.
The radius and angles can be found using the Cartesian-to-polar transform around the center:
R= Sqrt((Xa-X)^2+(Ya-Y)^2)
Ta= atan2(Ya-Y, Xa-X)
Tc= atan2(Yc-Y, Xc-X)
But you still miss one thing: what is the relevant part of the arc ? Smaller or larger than a half turn ? From Ta
to Tb
or from Tb
to 2 Pi
to Ta + 2 Pi
, or what ? The answer is much less obvious than it seems, try it (because the three angles Ta
, Tb
and Tc
are undeterminate to a multiple of 2 Pi
and you cannot sort them) !
Hint: consider the sign of the area of the triangle ABC, precisely the half of the determinant of the system. It will tell you if B lies on the left or the right of AC.
Step 1
Find the perpendicular bisector of AB and BC.
Step 2
Find the point in which these lines are intersected.
The point you will find would be the center of the circle you want.
Step 3
Calculate the distance of one of the three points from the center you found on Step 2. That would be the radius of you circle.
NOTE The points A, B and C must not be in the same line. You have to check this, before you execute the Steps 1 to 3.
The solution to this is almost identical to the "circle of best fit for a non-over-determined system". Since you have three points which are exactly on the arc former by the circle centered at (0,0)
(given), the system can be solved exactly rather than requiring a least-squares approximation.
Finding the Center of a Circle Given 3 Points
Date: 05/25/2000 at 00:14:35
From: Alison Jaworski
Subject: finding the coordinates of the center of a circle
Hi,
Can you help me? If I have the x and y coordinates of 3 points - i.e.
(x1,y1), (x2,y2) and (x3,y3) - how do I find the coordinates of the
center of a circle on whose circumference the points lie?
Thank you.
Date: 05/25/2000 at 10:45:58
From: Doctor Rob
Subject: Re: finding the coordinates of the center of a circle
Thanks for writing to Ask Dr. Math, Alison.
Let (h,k) be the coordinates of the center of the circle, and r its
radius. Then the equation of the circle is:
(x-h)^2 + (y-k)^2 = r^2
Since the three points all lie on the circle, their coordinates will
satisfy this equation. That gives you three equations:
(x1-h)^2 + (y1-k)^2 = r^2
(x2-h)^2 + (y2-k)^2 = r^2
(x3-h)^2 + (y3-k)^2 = r^2
in the three unknowns h, k, and r. To solve these, subtract the first
from the other two. That will eliminate r, h^2, and k^2 from the last
two equations, leaving you with two simultaneous linear equations in
the two unknowns h and k. Solve these, and you'll have the coordinates
(h,k) of the center of the circle. Finally, set:
r = sqrt[(x1-h)^2+(y1-k)^2]
and you'll have everything you need to know about the circle.
This can all be done symbolically, of course, but you'll get some
pretty complicated expressions for h and k. The simplest forms of
these involve determinants, if you know what they are:
|x1^2+y1^2 y1 1| |x1 x1^2+y1^2 1|
|x2^2+y2^2 y2 1| |x2 x2^2+y2^2 1|
|x3^2+y3^2 y3 1| |x3 x3^2+y3^2 1|
h = ------------------, k = ------------------
|x1 y1 1| |x1 y1 1|
2*|x2 y2 1| 2*|x2 y2 1|
|x3 y3 1| |x3 y3 1|
Example: Suppose a circle passes through the points (4,1), (-3,7), and
(5,-2). Then we know that:
(h-4)^2 + (k-1)^2 = r^2
(h+3)^2 + (k-7)^2 = r^2
(h-5)^2 + (k+2)^2 = r^2
Subtracting the first from the other two, you get:
(h+3)^2 - (h-4)^2 + (k-7)^2 - (k-1)^2 = 0
(h-5)^2 - (h-4)^2 + (k+2)^2 - (k-1)^2 = 0
h^2+6*h+9 - h^2+8*h-16 + k^2-14*k+49 - k^2+2*k-1 = 0
h^2-10*h+25 - h^2+8*h-16 + k^2+4*k+4 - k^2+2*k-1 = 0
14*h - 12*k + 41 = 0
-2*h + 6*k + 12 = 0
10*h + 65 = 0
30*k + 125 = 0
h = -13/2
k = -25/6
Then
r = sqrt[(4+13/2)^2 + (1+25/6)^2]
= sqrt[4930]/6
Thus the equation of the circle is:
(x+13/2)^2 + (y+25/6)^2 = 4930/36
- Doctor Rob, The Math Forum
http://mathforum.org/dr.math/
References
<http://mathforum.org/library/drmath/view/55239.html>
You have three equations to determine the three unknowns xM, yM and R,
(xA-xM)^2+(yA-yM^2) = R^2
etc. Subtracting the A equation from the B and C equations gives
2*(xB-xA)*xM+2*(yB-yA)*yM = xB^2-xA^2+yB^2-yA^2
2*(xC-xA)*xM+2*(yC-yA)*yM = xC^2-xA^2+yC^2-yA^2
By solving this 2x2 linear system, you obtain the center point of the circle, inserting in any of the original equation gives the radius.
There is a little known result giving the implicit equation of a circle through 3 points:
|Z X Y 1|
|Za Xa Ya 1|
|Zb Xb Yb 1| = 0
|Zc Xc Yc 1|
where we have defined Z:= X^2 + Y^2
for the sake of conciseness.
Computing the 3x3 minors, we develop into:
M00 Z + M10 X + M20 Y + M30 = 0
and, after normalization, we get the usual second degree equation:
X^2 + Y^2 + 2U X + 2V Y + W = 0
This can be rewritten as:
(X - U)^2 + (Y - V)^2 = U^2 + V^2 - W
immediately giving the center (U, V) = (-M10/2.M00, -M20/2.M00)
and the radius R^2 = U^2 + V^2 - M30/M00
.