Cody

Problem 45196. Determine whether a given point is inside or outside a polygon

Solution 2008874

Submitted on 8 Nov 2019 by Nikolaos Nikolaou
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
r = [44.28, 60.99]; y_correct = 0; assert(inOrOut(p,r) == y_correct);

xv = 0 0 5 10 15 20 25 30 35 40 45 50 50 0 yx = 0 100 10 100 20 100 30 100 40 100 50 100 0 0 InOut = logical 0

2   Pass
r = [38.33, 57.67]; y_correct = 1; assert(inOrOut(p,r) == y_correct);

xv = 0 0 5 10 15 20 25 30 35 40 45 50 50 0 yx = 0 100 10 100 20 100 30 100 40 100 50 100 0 0 InOut = logical 1

3   Pass
r = [0.98, 23.99]; y_correct = 1; assert(inOrOut(p,r) == y_correct);

xv = 0 0 5 10 15 20 25 30 35 40 45 50 50 0 yx = 0 100 10 100 20 100 30 100 40 100 50 100 0 0 InOut = logical 1

4   Pass
r = [27.07, 95.94]; y_correct = 0; assert(inOrOut(p,r) == y_correct);

xv = 0 0 5 10 15 20 25 30 35 40 45 50 50 0 yx = 0 100 10 100 20 100 30 100 40 100 50 100 0 0 InOut = logical 0

5   Pass
r = [ -7.45, 7.14]; y_correct = 0; assert(inOrOut(p,r) == y_correct);

xv = 0 0 5 10 15 20 25 30 35 40 45 50 50 0 yx = 0 100 10 100 20 100 30 100 40 100 50 100 0 0 InOut = logical 0

6   Pass
r = [43.19, 2.87]; y_correct = 1; assert(inOrOut(p,r) == y_correct);

xv = 0 0 5 10 15 20 25 30 35 40 45 50 50 0 yx = 0 100 10 100 20 100 30 100 40 100 50 100 0 0 InOut = logical 1

7   Pass
r = [19.39, 16.79]; y_correct = 1; assert(inOrOut(p,r) == y_correct);

xv = 0 0 5 10 15 20 25 30 35 40 45 50 50 0 yx = 0 100 10 100 20 100 30 100 40 100 50 100 0 0 InOut = logical 1

8   Pass
r = [48.72, 71.27]; y_correct = 1; assert(inOrOut(p,r) == y_correct);

xv = 0 0 5 10 15 20 25 30 35 40 45 50 50 0 yx = 0 100 10 100 20 100 30 100 40 100 50 100 0 0 InOut = logical 1

9   Pass
r = [-6.42, 68.20]; y_correct = 0; assert(inOrOut(p,r) == y_correct);

xv = 0 0 5 10 15 20 25 30 35 40 45 50 50 0 yx = 0 100 10 100 20 100 30 100 40 100 50 100 0 0 InOut = logical 0

10   Pass
r = [20.03, 47.11]; y_correct = 1; assert(inOrOut(p,r) == y_correct);

xv = 0 0 5 10 15 20 25 30 35 40 45 50 50 0 yx = 0 100 10 100 20 100 30 100 40 100 50 100 0 0 InOut = logical 1

Suggested Problems

More from this Author2