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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
Select every other element of a vector
20334 Solvers
482 Solvers
Sum of first n terms of a harmonic progression
257 Solvers
Crossing to Kissing - Untangle the Lines
24 Solvers
How long is the longest prime diagonal?
338 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!