@squawk
    Preparing search index...

    Function polygonsSubstantiallyOverlap

    • Tests whether two polygons substantially overlap using a bidirectional centroid heuristic: identical polygons always count, and otherwise the two are considered overlapping iff a's centroid lies inside b OR b's centroid lies inside a. This catches small-feature-inside-big and big-feature-inside-small without computing actual intersection area.

      The caller may pass aCentroid when it has already been computed (the common case in viewport-aware filters), letting this function skip a redundant centroid pass over a.

      Parameters

      • a: Polygon

        First polygon.

      • b: Polygon

        Second polygon.

      • OptionalaCentroid: readonly [number, number]

        Optional pre-computed centroid of a to avoid recomputation.

      Returns boolean

      true when the polygons overlap by the heuristic above.