google / s2geometry

Computational geometry and spatial indexing on the sphere
http://s2geometry.io/
Apache License 2.0
2.29k stars 302 forks source link

Is exist way to get initial shapes from s2 index intersection. #289

Closed MBkkt closed 1 year ago

MBkkt commented 1 year ago

I have N polygons (X) and 1 polygon (Y). I want to find all polygons from X which intersects with Y as fast as possible. Of course I can just make a for loop X and intersect each polygon with Y. But it's not effective :( A lot of allocation and other work.

I know I can create single S2ShapeIndex from X. And then intersect it with Y. I thought maybe it will be faster if exist way to get initial shapes from intersection result?