isInBoundingBox static method

bool isInBoundingBox({
  1. required GeoPoint point,
  2. required GeoPolygon polygon,
})

Performs a quick bounding box check before full polygon test.

This is an optimization to quickly reject points that are clearly outside the polygon's bounding box.

Returns: true if point is within bounding box

Implementation

static bool isInBoundingBox({
  required GeoPoint point,
  required GeoPolygon polygon,
}) {
  final bbox = getBoundingBox(polygon);

  return point.latitude >= bbox['south']! &&
      point.latitude <= bbox['north']! &&
      point.longitude >= bbox['west']! &&
      point.longitude <= bbox['east']!;
}