Cody

# Problem 1385. Perimeter

Solution 1925781

Submitted on 8 Sep 2019
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
xy=[0,0; 1,0; 1,1; 0,1; 0,0]; err=(abs(perimeter1(xy)-4)/(4))*100; assert(err<.1)

polyin = polyshape with properties: Vertices: [4×2 double] NumRegions: 1 NumHoles: 0

Output argument "L" (and maybe others) not assigned during call to "perimeter1". Error in Test1 (line 8) err=(abs(perimeter1(xy)-4)/(4))*100;

2   Fail
t=[0:pi/100:2*pi,0]'; xy=[cos(t),sin(t)]; err=(abs(perimeter1(xy)-2*pi)/(2*pi))*100; assert(err<.1)

[Warning: Polyshape has duplicate vertices, intersections, or other inconsistencies that may produce inaccurate or unexpected results. Input data has been modified to create a well-defined polyshape.] [> In polyshape/checkAndSimplify (line 476) In polyshape (line 175) In perimeter1 (line 2) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] polyin = polyshape with properties: Vertices: [200×2 double] NumRegions: 1 NumHoles: 0

Output argument "L" (and maybe others) not assigned during call to "perimeter1". Error in Test2 (line 5) err=(abs(perimeter1(xy)-2*pi)/(2*pi))*100;

3   Fail
t=[0:pi/100:pi,0]'; xy=[cos(t),sin(t)]; err=(abs(perimeter1(xy)-(pi+2))/(2+pi))*100; assert(err<.1)

polyin = polyshape with properties: Vertices: [101×2 double] NumRegions: 1 NumHoles: 0

Output argument "L" (and maybe others) not assigned during call to "perimeter1". Error in Test3 (line 4) err=(abs(perimeter1(xy)-(pi+2))/(2+pi))*100;

4   Fail
side=rand; x=side*[-1 -0.5 0.5 1 0.5 -0.5 -1]; y=side*sqrt(3)*[0 -0.5 -0.5 0 0.5 0.5 0]; xy=[x',y']; err=(abs(perimeter1(xy)-(6*side))/(6*side))*100; assert(err<.1)

polyin = polyshape with properties: Vertices: [6×2 double] NumRegions: 1 NumHoles: 0

Output argument "L" (and maybe others) not assigned during call to "perimeter1". Error in Test4 (line 5) err=(abs(perimeter1(xy)-(6*side))/(6*side))*100;