I have a very large dataset consisting of (x, y) coordinates. I need to know which of these points is in certain areas of 2D space. These areas are limited by 4 lines in the 2D area (some sides are slightly curved).
For smaller datasets, I used a cumbersome loop to test each individual membership point in each region. This no longer looks like a good option due to the size of the dataset.
Is there a better way to do this?
For example:
If I have a set of points: (0,1) (1,2) (3,7) (1,4) (7,5)
and the area bounded by lines:
y=2
y=5
y=5*sqrt(x) +1
x=2
I want to find a way to identify a point (or points) in this area.
Thanks.
The exact code is on another computer, but from memory it is something like:
point_list = []
for i in range(num_po):
a=5*sqrt(points[i,0]) +1
b=2
c=2
d=5
if (points[i,1]<a) && (points[i,0]<b) && (points[i,1]>c) && (points[i,1]<d):
point_list.append(points[i])
This is not exact code, but should give an idea of what I tried.