Cody

# Problem 1651. Circumcircle Points

Solution 3086836

Submitted on 6 Oct 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
pts=[0 0;5 0;1.8 2.4]; % 3 4 5 triangle r_exp=2.5; r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0 s2 = 2.5000

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test1 (line 3) r = Circumcircle_radius(pts);

2   Fail
pts=[0 0;6 0;1.8 2.4]; % 3 x 6 triangle r_exp=3; % Two Point Solver r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0 s2 = 3

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test2 (line 3) r = Circumcircle_radius(pts);

3   Fail
pts=[0 0;0 1;1 2;3 0]; % r^2=2.5 r_exp=sqrt(2.5); r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0 s2 = 0.5000

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test3 (line 3) r = Circumcircle_radius(pts);

4   Fail
pts=[0 1; 0 3; 0 4; 2 6; 3 0; 4 5]; % r2 9.2820069 r_exp=sqrt(9.2820069 ); r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0.5000 s2 = 1.5000

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test4 (line 3) r = Circumcircle_radius(pts);

5   Fail
pts=[0,2;0,6;1,1;3,0;3,3;4,10;5,10;7,2;9,7]; % r2 26.6919 r_exp=sqrt(26.6919420552286 ); r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 1 s2 = 3

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test5 (line 3) r = Circumcircle_radius(pts);

6   Fail
pts=[0,19;1,25;1,30;1,34;3,11;4,30;8,17;9,6;11,44;12,45;15,46;21,0;21,9;21,48;22,42;26,11;31,40;34,27;37,44;39,34;41,8;43,9;43,10;46,16;46,35;48,23]; % r2 exp 608.7807 r_exp=sqrt(608.780718525455); r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 9.5000 s2 = 13

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test6 (line 3) r = Circumcircle_radius(pts);

7   Fail
% Random case to avoid hard coders xc=rand; yc=rand; r=.5+rand; pts=[]; % Equilateral points pts(1,:)=[xc+r,yc]; pts(2,:)=[xc+r*cos(2*pi/3),yc+r*sin(2*pi/3)]; pts(3,:)=[xc+r*cos(-2*pi/3),yc+r*sin(-2*pi/3)]; for i=4:10 rnew=rand*r; theta=randi(360)*pi/180; pts(i,:)=[xc+rnew*cos(theta),yc+rnew*sin(theta)]; end pts=pts(randperm(size(pts,1)),:); r_exp=r; r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0.5459 s2 = -0.1978

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test7 (line 17) r = Circumcircle_radius(pts);

8   Fail
% Random case to avoid hard coders xc=rand; yc=rand; r=.5+rand; pts=[]; % Equilateral points pts(1,:)=[xc+r,yc]; pts(2,:)=[xc+r*cos(2*pi/3),yc+r*sin(2*pi/3)]; pts(3,:)=[xc+r*cos(-2*pi/3),yc+r*sin(-2*pi/3)]; for i=4:30 rnew=rand*r; theta=randi(360)*pi/180; pts(i,:)=[xc+rnew*cos(theta),yc+rnew*sin(theta)]; end pts=pts(randperm(size(pts,1)),:); r_exp=r; r = Circumcircle_radius(pts); assert(abs(r-r_exp)<.001)

s1 = 0.5420 s2 = 1.3188

Output argument "r" (and maybe others) not assigned during call to "Circumcircle_radius". Error in Test8 (line 17) r = Circumcircle_radius(pts);

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!