isInsidePolygonOptimized static method
Optimized point-in-polygon check with bounding box pre-check.
This method first checks if the point is within the bounding box, which is much faster than the full ray casting for points far outside.
Returns: true if the point is inside the polygon
Implementation
static bool isInsidePolygonOptimized({
required GeoPoint point,
required GeoPolygon polygon,
}) {
// Quick bounding box rejection
if (!isInBoundingBox(point: point, polygon: polygon)) {
return false;
}
// Full ray casting check
return isInsidePolygon(point: point, polygon: polygon);
}