Function S2Polygon.setS2debugOverride

Destroys the polygon and frees its loops.

void setS2debugOverride (
  s2.s2debug.S2Debug s2debugOverride
);

Allows overriding the automatic validity checks controlled by --s2debug (which is true by default in non-optimized builds). When this flag is enabled, a fatal error is generated whenever an invalid polygon is constructed. The main reason to disable this flag is if you intend to call IsValid() explicitly, like this:

S2Polygon polygon; polygon.set_s2debug_override(S2Debug::DISABLE); polygon.Init(...); if (!polygon.IsValid()) { ... }

This setting is preserved across calls to Init() and Decode().