We could apply the same idea as LUCENE-7656 to LatLonPointInPolygonQuery.
Here is a patch. I am seeing the following speedups with IndexAndSearchOpenStreetMaps:
It seems to help with complex polygons.
Commit d2051e3f9d4edeb5d6c74f71684c14596453b4a2 in lucene-solr's branch refs/heads/branch_6x from Adrien Grand
[ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=d2051e3 ]
LUCENE-7661: Speed up for LatLonPointInPolygonQuery by pre-computing the relation of the polygon with a grid.
Commit 74240be0f5a7f9de373bc53d01d5a43cd6c5bb05 in lucene-solr's branch refs/heads/master from Adrien Grand
[ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=74240be ]
The Russia and London boroughs polygons show a speedup, and interestingly the simple "poly 10" too: http://people.apache.org/~mikemccand/geobench.html.
Wow that is a nice jump in polygon performance!