Cody

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

Solution 3814183

Submitted on 24 Nov 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
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))

toDel = 2 3 6 7 12 13 Q = 2 0 5 0 6 1 5 3 4 4 3 4 2 3 0 2 1 1

Assertion failed.

2   Fail
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))

toDel = 3 8 9 Q = 3 0 6 2 5 3 4 4 1 4 0 3 1 0

Assertion failed.

Suggested Problems

More from this Author14

Community Treasure Hunt

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

Start Hunting!