Re: circumcircle
- From: "Stuart" <stuart@xxx>
- Date: Thu, 31 Jan 2008 09:07:41 -0000
What is the easiest way to find the circumcircle of a triangle given
the triangle's 3 points?
Well, the three points (x1, y1), (x2, y2), (x3, y3) must satisfy the
equation:
(xp-xc)^2 + (yp-yc)^2 = r^2
where (xc, yc) is the centre of the circumcircle, r is its radius and (xp,
yp) is each of the three points. Of course you do not know (xc, yc) or r
yet.
With a little algebra you can expand the above, and in the resulting set of
simultaneous equations it is easy to eliminate the terms in xc^2, yc^2 and
r^2; leaving simultaneous equations in xc and yc.
You write an algorithm to compute the coefficients of these simultaneous
equations [from the expressions in (x1, y1), ... you have derived] and solve
the set of simultaneous equations to give (xc, yc) and then derive r.
Award yourself bonus marks for detecting cases where the simultaneous
equations are not independent (i.e. the points do not describe a triangle).
Award yourself further bonus marks for detecting cases where the numerical
solution to the simultaneous equations is not well-conditioned (and hence
your circumcircle is probably inaccurate).
You could, of course, press on with the algebra and determine a general
solution for xc, yc, & r in (x1, y1), ... and program this directly [watch
out for those cases where the points don't describe a triangle, and the
results are not well-conditioned].
--
Stuart
.
- References:
- circumcircle
- From: bob
- circumcircle
- Prev by Date: Re: circumcircle
- Next by Date: Socket Problem
- Previous by thread: Re: circumcircle
- Next by thread: Socket Problem
- Index(es):