Cody

# Problem 43023. Remove collinear points in a set of 2D points defining a polygon

Solution 2909299

Submitted on 4 Sep 2020 by Rafael S.T. Vieira
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
x=[2,3,4,5,6,6,6,5,4,3,2,1,0,0,1]; y=[0,0,0,0,1,2,3,3,4,4,3,3,3,2,1]; P=[x;y]'; a = [2,5,6,6,5,4,3,2,0,0]; b = [0,0,1,3,3,4,4,3,3,2]; Q=[a;b]'; assert(isequal(polygon_red(P),Q))

[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 polygon_red (line 2) In ScoringEngineTestPoint1 (line 7) In solutionTest (line 3)]

2   Pass
x=[3,6,6,5,4,1,0,0,0,1]; y=[0,2,3,3,4,4,3,1,0,0]; P=[x;y]'; a = [3,6,6,5,4,1,0,0]; b = [0,2,3,3,4,4,3,0]; Q=[a;b]'; assert(isequal(polygon_red(P),Q))

[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 polygon_red (line 2) In ScoringEngineTestPoint2 (line 7) In solutionTest (line 5)]

### Community Treasure Hunt

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

Start Hunting!