Cody

Problem 558. Is the Point in a Triangle?

Solution 2195162

Submitted on 6 Apr 2020 by Pauli Huusari
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
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 test_vector = 0 0.5000 cosine_of_test_point = 0 true_false = logical 0 y = 0

2   Pass
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 test_vector = 0.8000 0.5000 cosine_of_test_point = 0.8480 test_vector = -0.2000 0.5000 cosine_of_test_point = 0.9285 test_vector = -0.2000 -0.5000 cosine_of_test_point = 0.9191 true_false = logical 1 y = 1

3   Pass
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 test_vector = -0.0147 -0.2134 cosine_of_test_point = 0.9278 test_vector = -0.1058 0.0676 cosine_of_test_point = 0.3898 test_vector = 0.6730 0.6025 cosine_of_test_point = 0.9902 true_false = logical 1 test_vector = 0.0853 -0.5134 cosine_of_test_point = 0.9889 test_vector = -0.0058 -0.2324 cosine_of_test_point = 0.5865 test_vector = 0.7730 0.3025 cosine_of_test_point = 0.8788 true_false = logical 0 y = 1 0

Suggested Problems

More from this Author1

Community Treasure Hunt

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

Start Hunting!