Smallest enclosing circle problem: Difference between revisions
Smallest enclosing circle problem (view source)
Revision as of 13:35, 16 November 2020
, 3 years ago→{{header|Phix}}: minor simplifications
m (→{{header|Wren}}: Typo.) |
m (→{{header|Phix}}: minor simplifications) |
||
Line 358:
function circle_from2(point a, b)
-- return the smallest circle that intersects 2 points:
point
atom
circle res = {
return res
end function
Line 366:
function circle_from3(point a, b, c)
-- return a unique circle that intersects three points
atom
D
(bX*C - cX*B)/D + aY }
atom radius = distance(centre,a) -- (=== b,c)
circle res = { centre, radius }
return res
end function
Line 396 ⟶ 399:
procedure welzl(sequence p)
string s = sprintf("centre %v radius %.14g",c)
printf(1,"Points %v ==> %s\n",{p,s})
end procedure
constant tests = {{
{
papply(tests,welzl)</lang>
{{out}}
|