Function S2Polygon.approxEquals

Return true if two polygons are approximately equal to within the given tolerance. This is true if it is possible to move the vertices of the two polygons so that they contain the same set of points.

bool approxEquals (
  S2Polygon b,
  S1Angle tolerance
);

Note that according to this model, small regions less than "tolerance" in width do not need to be considered, since these regions can be collapsed into degenerate loops (which contain no points) by moving their vertices.

This model is not as strict as using the Hausdorff distance would be, and it is also not as strict as BoundaryNear (defined below). However, it is a good choice for comparing polygons that have been snapped, simplified, unioned, etc, since these operations use a model similar to this one (i.e., degenerate loops or portions of loops are automatically removed).