Cody

# Problem 1720. Do the lines intersect?

Solution 1588179

Submitted on 20 Jul 2018 by Yu Wang
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 ))

c1 = 1 d1 = 0 c2 = -1 d2 = 1 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 ))

c1 = 0 d1 = 0 c2 = 0 d2 = 1 x = Inf y = NaN 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 ))

c1 = 0 d1 = 0 c2 = 0 d2 = 0 x = NaN y = NaN 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 ))

c1 = 2.5000 d1 = -7 c2 = 0.6667 d2 = 5 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 ))

x = 6 c2 = 0.3333 d2 = 3.6667 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 ))

c1 = -0.2000 d1 = -2.4000 c2 = -5 d2 = -4 x = -0.3333 y = -2.3333 tf = logical 1