'python - mpltPath.Path(polygon).contains_points(points)

I have a list of polygon's corners points (polygon) and a list of x,y points (points).

when I do mpltPath.Path(polygon).contains_points(points) I get a list of True/False on the index if each point in the points list.

my problem is that I don't know how to directly extract these specific points in a fast way.

I tried too do for loop and get all the indexes of the "True" but the problem is that it takes too long (its a list of 100M points) and I wondered if there is a faster way to get it directly from mpltPath package.

here is what I tried to get the indexes but it took too long:

list(locate(mpltPath.Path(polygon).contains_points(points), lambda x: x == 'True'))


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source