Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Circumscribing circles
Date: Thu, 18 Nov 2010 19:00:07 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 17
Message-ID: <ic3t3n$qfi$1@fred.mathworks.com>
References: <ic2go7$74h$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1290106807 27122 172.30.248.37 (18 Nov 2010 19:00:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 18 Nov 2010 19:00:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:688126

"Joshua " <jtnciolet@wichita.edu> wrote in message <ic2go7$74h$1@fred.mathworks.com>...
> .......
> that computes both the center and radius of the circle containing the three points A,B, and C ........
> ......
- - - - - - - - - - - -
  Here is code that computes the center, (xc,yc), and radius, r, of the circle circumscribing the triangle with vertices (x1,y1), (x2,y2), and (x3,y3).

x21 = x2-x1; y21 = y2-y1;
x31 = x3-x1; y31 = y3-y1;
d21 = x21^2+y21^2;
d31 = x31^2+y31^2;
a4 = 2*(x21*y31-y21*x31);
xc = x1+(y31*d21-y21*d31)/a4;
yc = y1+(x21*d31-x31*d21)/a4;
r = sqrt(d21*d31*((x3-x2)^2+(y3-y2)^2))/abs(a4);

Roger Stafford