Cody

# Problem 1456. Beads on a Necklace (Convex Hulls)

Solution 1950519

Submitted on 27 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   Pass
xy = [1 1;1 2;2 2;2 1]; tf_correct = true; assert(isequal(allConvex(xy),tf_correct))

tf = logical 1

2   Fail
xy = [1 1;3 1;2 2;2 3]; tf_correct = false; assert(isequal(allConvex(xy),tf_correct))

Matrix dimensions must agree. Error in allConvex (line 3) tf = all(sortrows(xy) == sortrows(c.Vertices),"all") Error in Test2 (line 3) assert(isequal(allConvex(xy),tf_correct))

3   Fail
xy = [6 4;10 6;10 3;3 1;5 5]; tf_correct = false; assert(isequal(allConvex(xy),tf_correct))

Matrix dimensions must agree. Error in allConvex (line 3) tf = all(sortrows(xy) == sortrows(c.Vertices),"all") Error in Test3 (line 3) assert(isequal(allConvex(xy),tf_correct))

4   Pass
xy = [8 4;3 7;4 10;9 10;9 6;5 4]; tf_correct = true; assert(isequal(allConvex(xy),tf_correct))

[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 480) In polyshape (line 175) In allConvex (line 2) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)] tf = logical 1

5   Fail
xy = [14 26;14 29;2 15;2 7;3 7;18 17;8 23;26 11]; tf_correct = false; assert(isequal(allConvex(xy),tf_correct))

[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 480) In polyshape (line 175) In allConvex (line 2) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)]

Matrix dimensions must agree. Error in allConvex (line 3) tf = all(sortrows(xy) == sortrows(c.Vertices),"all") Error in Test5 (line 3) assert(isequal(allConvex(xy),tf_correct))

6   Fail
xy = [18 11;9 8;4 10;12 30;25 17;30 23;26 26;3 6]; tf_correct = true; assert(isequal(allConvex(xy),tf_correct))

[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 480) In polyshape (line 175) In allConvex (line 2) In ScoringEngineTestPoint6 (line 3) In solutionTest (line 13)]

Matrix dimensions must agree. Error in allConvex (line 3) tf = all(sortrows(xy) == sortrows(c.Vertices),"all") Error in Test6 (line 3) assert(isequal(allConvex(xy),tf_correct))

7   Fail
xy = [1 1;1 2;1 3;3 3;3 1]; tf_correct = true; assert(isequal(allConvex(xy),tf_correct))

[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 480) In polyshape (line 175) In allConvex (line 2) In ScoringEngineTestPoint7 (line 3) In solutionTest (line 15)]

Matrix dimensions must agree. Error in allConvex (line 3) tf = all(sortrows(xy) == sortrows(c.Vertices),"all") Error in Test7 (line 3) assert(isequal(allConvex(xy),tf_correct))

### Community Treasure Hunt

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

Start Hunting!