Cody

# Problem 1720. Do the lines intersect?

Solution 1684585

Submitted on 1 Dec 2018 by Martin C.
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 ))

a1 = 1 b1 = 0 a2 = -1 b2 = 1 M = 1 -1 -1 -1 sol = 0.5000 0.5000 x = 0.5000 y = 0.5000 tf = logical 1

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

a1 = 0 b1 = 0 a2 = 0 b2 = 1 M = 0 -1 0 -1 tf = logical 0

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

a1 = 0 b1 = 0 a2 = 0 b2 = 0 M = 0 -1 0 -1 tf = logical 0

4   Pass
a = [4 3;6 8]; b = [3 7;6 9]; tf_correct = false; assert(isequal(intersecting(a,b),tf_correct ))

a1 = 2.5000 b1 = -7 a2 = 0.6667 b2 = 5 M = 2.5000 -1.0000 0.6667 -1.0000 sol = 6.5455 9.3636 x = 6.5455 y = 9.3636 tf = logical 0

5   Pass
a = [6 2;6 9]; b = [7 6;4 5]; tf_correct = true; assert(isequal(intersecting(a,b),tf_correct ))

a1 = 1 A1 = 0 b1 = -6 a2 = 0.3333 b2 = 3.6667 M = 1.0000 0 0.3333 -1.0000 sol = 6.0000 5.6667 x = 6 y = 5.6667 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 ))

a1 = -0.2000 b1 = -2.4000 a2 = -5 b2 = -4 M = -0.2000 -1.0000 -5.0000 -1.0000 sol = -0.3333 -2.3333 x = -0.3333 y = -2.3333 tf = logical 1