Cody

# Problem 1720. Do the lines intersect?

Solution 2015811

Submitted on 12 Nov 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
a = [0,0; 1,1]; b = [0,1; 1,0]; tf_correct = true; assert(isequal(intersecting(a,b),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 intersecting (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)] Sshape = 0.5000 k = 1 4 2 3 1 Scover = 1 tf = logical 1

2   Fail
a = [0,0; 1,0]; b = [0,1; 1,1]; tf_correct = false; assert(isequal(intersecting(a,b),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 intersecting (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] Sshape = 0.5000 k = 1 2 4 3 1 Scover = 1 tf = logical 1

Assertion failed.

3   Pass
a = [0,0; 1,0]; b = [2,0; 3,0]; tf_correct = false; assert(isequal(intersecting(a,b),tf_correct ))

[Warning: Output contains an empty polyshape due to duplicate vertices, intersections, or other inconsistencies.] [> In polyshape/checkAndSimplify (line 469) In polyshape (line 175) In intersecting (line 2) In ScoringEngineTestPoint3 (line 4) In solutionTest (line 7)] [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 intersecting (line 2) In ScoringEngineTestPoint3 (line 4) In solutionTest (line 7)] Sshape = 0 k = [] Scover = 0 tf = logical 0

4   Fail
a = [4 3;6 8]; b = [3 7;6 9]; tf_correct = false; assert(isequal(intersecting(a,b),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 intersecting (line 2) In ScoringEngineTestPoint4 (line 4) In solutionTest (line 9)] Sshape = 2.1250 k = 1 2 4 3 1 Scover = 8 tf = logical 1

Assertion failed.

5   Pass
a = [6 2;6 9]; b = [7 6;4 5]; tf_correct = true; assert(isequal(intersecting(a,b),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 intersecting (line 2) In ScoringEngineTestPoint5 (line 4) In solutionTest (line 11)] Sshape = 5.3333 k = 1 3 2 4 1 Scover = 10.5000 tf = logical 1

6   Pass
a = [3 -3;-2 -2]; b = [-1 1;0 -4]; tf_correct = true; assert(isequal(intersecting(a,b),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 intersecting (line 2) In ScoringEngineTestPoint6 (line 4) In solutionTest (line 13)] Sshape = 5.3333 k = 1 3 2 4 1 Scover = 12 tf = logical 1