cesium-native icon indicating copy to clipboard operation
cesium-native copied to clipboard

Improve accuracy of `withinPolygons` test

Open kring opened this issue 4 years ago • 0 comments

RasterizedPolygonsOverlay and RasterizedPolygonsTileExluder both use a simple test to exclude tiles that fall entirely inside a polygon that is meant to be used for clipping:

  1. Determine a GlobeRectangle representing the bounds of the Tile.
  2. Check if the GlobeRectangle lies entirely inside the polygon.

But step 1 is not very accurate when the Tile's bounding volume is not a region. Just like in #383, the rectangle is determined by projecting edges of the Tile's bounding volume. This is inaccurate in that it may indicate too big a region, and also it's possible for parts of the tile to extend outside the computed region (especially for big tiles).

Unlike #383, though, there are no easy and performant solutions (to my knowledge). The solution will probably involve computing some kind of Cartesian-space bounding volume for the polygon that we can test other Cartesian-space bounding volumes against. That's already tricky because the polygon is 2D and meant to apply to geometry at any height.

kring avatar Nov 02 '21 05:11 kring