I have a collection of 2D points S
and I need to test if an input point q
is inside or outside the convex hull of S
.
Since it\
This problem can be categorized as a classic point-location
problem.
The preprocessing would include calculating convex hull for the set of points, and the line segments of the convex hull would be used in the next step (or the whole of CH as a region).
There are many standard O(log n)
query-time algorithms for this kind of problems (http://en.wikipedia.org/wiki/Point_location) like Kirkpatrick triangulation, randomized trapezoidal maps, etc..
Also note that in expectation, the number of points in CH(S)
is O(log N)
where N
is the number of total points in S
. So the number of line segments considered for point location is already reduced to O(log N)
, which means that the query time is actually O(log log N) in expectation (in terms of total points in S
).