Problem 44059. Convex Hull Capture
Imagine four points in uv that form a square.
uv = [ ...
0,0;
0,2;
2,2;
2,0];
Now we have two more points in xy: one at [1,1] and the other at [1,3]. The first one is in the square, and the second is outside it.
xy = [ ...
1,1;
3,1];
Here is the challenge. Consider the convex hull formed by the points in uv. Which points in xy lie inside this hull?
In this case, the answer would be the logical vector [1,0], since the first row of xy is in the box defined by uv, whereas the second row is not.
Example
uv = [13,12;10,18;8,4;12,10;16,4;13,2;];
xy = [12,15;9,7;9,13;13,8;];
in_correct = [0;1;0;1;];
Solution Stats
Problem Comments
-
1 Comment
Peng Liu
on 1 Feb 2017
This problem may be generalized to a more challenging case: the N-D convex hull.
Solution Comments
Show commentsProblem Recent Solvers28
Suggested Problems
-
Flip the main diagonal of a matrix
806 Solvers
-
Remove the two elements next to NaN value
651 Solvers
-
Relative ratio of "1" in binary number
1409 Solvers
-
Replace secondary diagonal elements of a square array
162 Solvers
-
1266 Solvers
More from this Author50
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!