Cody

Problem 558. Is the Point in a Triangle?

Solution 2203688

Submitted on 10 Apr 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
Triangle = [0, 0; 1, 0; 1, 1]; Points = [0, 0.5] y_correct = 0; assert(isequal(your_fcn_name(Points,Triangle),y_correct))

Points = 0 0.5000 x1 = 0 x2 = 1 x3 = 1 y1 = 0 y2 = 0 y3 = 1

Unrecognized function or variable 'x'. Error in your_fcn_name (line 10) a = ((y2 - y3)*(x - x3) + (x3 - x2)*(y - y3)) / d; Error in Test1 (line 3) assert(isequal(your_fcn_name(Points,Triangle),y_correct))

2   Fail
Triangle = [0, 0; 1, 0; 1, 1]; Points = [0.8, 0.5] y_correct = 1; assert(isequal(your_fcn_name(Points,Triangle),y_correct))

Points = 0.8000 0.5000 x1 = 0 x2 = 1 x3 = 1 y1 = 0 y2 = 0 y3 = 1

Unrecognized function or variable 'x'. Error in your_fcn_name (line 10) a = ((y2 - y3)*(x - x3) + (x3 - x2)*(y - y3)) / d; Error in Test2 (line 3) assert(isequal(your_fcn_name(Points,Triangle),y_correct))

3   Fail
Triangle = [0.8147, 0.9134; 0.9058, 0.6324; 0.1270, 0.0975]; Points = [0.8, 0.7; 0.9, 0.4] y_correct = [1 0]; assert(isequal(your_fcn_name(Points,Triangle),y_correct))

Points = 0.8000 0.7000 0.9000 0.4000 x1 = 0.8147 x2 = 0.9058 x3 = 0.1270 y1 = 0.9134 y2 = 0.6324 y3 = 0.0975

Unrecognized function or variable 'x'. Error in your_fcn_name (line 10) a = ((y2 - y3)*(x - x3) + (x3 - x2)*(y - y3)) / d; Error in Test3 (line 4) assert(isequal(your_fcn_name(Points,Triangle),y_correct))