# This file was automatically generated by SWIG (https://www.swig.org).
# Version 4.2.1
#
# Do not make changes to this file unless you know what you are doing - modify
# the SWIG interface file instead.

from sys import version_info as _swig_python_version_info
# Import the low-level C/C++ module
if __package__ or "." in __name__:
    from . import _s2geometry
else:
    import _s2geometry

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "this":
            set(self, name, value)
        elif name == "thisown":
            self.this.own(value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)


class SwigPyIterator(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined - class is abstract")
    __repr__ = _swig_repr
    __swig_destroy__ = _s2geometry.delete_SwigPyIterator

    def value(self):
        return _s2geometry.SwigPyIterator_value(self)

    def incr(self, n=1):
        return _s2geometry.SwigPyIterator_incr(self, n)

    def decr(self, n=1):
        return _s2geometry.SwigPyIterator_decr(self, n)

    def distance(self, x):
        return _s2geometry.SwigPyIterator_distance(self, x)

    def equal(self, x):
        return _s2geometry.SwigPyIterator_equal(self, x)

    def copy(self):
        return _s2geometry.SwigPyIterator_copy(self)

    def next(self):
        return _s2geometry.SwigPyIterator_next(self)

    def __next__(self):
        return _s2geometry.SwigPyIterator___next__(self)

    def previous(self):
        return _s2geometry.SwigPyIterator_previous(self)

    def advance(self, n):
        return _s2geometry.SwigPyIterator_advance(self, n)

    def __eq__(self, x):
        return _s2geometry.SwigPyIterator___eq__(self, x)

    def __ne__(self, x):
        return _s2geometry.SwigPyIterator___ne__(self, x)

    def __iadd__(self, n):
        return _s2geometry.SwigPyIterator___iadd__(self, n)

    def __isub__(self, n):
        return _s2geometry.SwigPyIterator___isub__(self, n)

    def __add__(self, n):
        return _s2geometry.SwigPyIterator___add__(self, n)

    def __sub__(self, *args):
        return _s2geometry.SwigPyIterator___sub__(self, *args)
    def __iter__(self):
        return self

# Register SwigPyIterator in _s2geometry:
_s2geometry.SwigPyIterator_swigregister(SwigPyIterator)
class Encoder(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    __swig_destroy__ = _s2geometry.delete_Encoder

    def __init__(self, *args):
        _s2geometry.Encoder_swiginit(self, _s2geometry.new_Encoder(*args))

    def reset(self, buf):
        return _s2geometry.Encoder_reset(self, buf)

    def clear(self):
        return _s2geometry.Encoder_clear(self)

    def put8(self, v):
        return _s2geometry.Encoder_put8(self, v)

    def put16(self, v):
        return _s2geometry.Encoder_put16(self, v)

    def put32(self, v):
        return _s2geometry.Encoder_put32(self, v)

    def put64(self, v):
        return _s2geometry.Encoder_put64(self, v)

    def putfloat(self, f):
        return _s2geometry.Encoder_putfloat(self, f)

    def putdouble(self, d):
        return _s2geometry.Encoder_putdouble(self, d)

    def length(self):
        return _s2geometry.Encoder_length(self)

    def avail(self):
        return _s2geometry.Encoder_avail(self)

    def Ensure(self, N):
        return _s2geometry.Encoder_Ensure(self, N)

    def buffer(self):
        return _s2geometry.Encoder_buffer(self)

# Register Encoder in _s2geometry:
_s2geometry.Encoder_swigregister(Encoder)
class Decoder(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def reset(self, buf):

        self._data_keepalive = args[0]


        return _s2geometry.Decoder_reset(self, buf)


    def get8(self):
        return _s2geometry.Decoder_get8(self)

    def get16(self):
        return _s2geometry.Decoder_get16(self)

    def get32(self):
        return _s2geometry.Decoder_get32(self)

    def get64(self):
        return _s2geometry.Decoder_get64(self)

    def getfloat(self):
        return _s2geometry.Decoder_getfloat(self)

    def getdouble(self):
        return _s2geometry.Decoder_getdouble(self)

    def pos(self):
        return _s2geometry.Decoder_pos(self)

    def avail(self):
        return _s2geometry.Decoder_avail(self)

    def __init__(self, *args):

        if len(args) == 1:
          self._data_keepalive = args[0]


        _s2geometry.Decoder_swiginit(self, _s2geometry.new_Decoder(*args))
    __swig_destroy__ = _s2geometry.delete_Decoder

# Register Decoder in _s2geometry:
_s2geometry.Decoder_swigregister(Decoder)

def FromS2CellId(cell_id):
    return _s2geometry.FromS2CellId(cell_id)

def S2Point_FromRaw(x, y, z):
    return _s2geometry.S2Point_FromRaw(x, y, z)

def S2Point_ToRaw(p):
    return _s2geometry.S2Point_ToRaw(p)
class S2Point(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def x(self):
        return _s2geometry.S2Point_x(self)

    def y(self):
        return _s2geometry.S2Point_y(self)

    def z(self):
        return _s2geometry.S2Point_z(self)

    def Norm(self):
        return _s2geometry.S2Point_Norm(self)

    def Normalize(self):
        return _s2geometry.S2Point_Normalize(self)
    __swig_destroy__ = _s2geometry.delete_S2Point

    def __init__(self):
        _s2geometry.S2Point_swiginit(self, _s2geometry.new_S2Point())

# Register S2Point in _s2geometry:
_s2geometry.S2Point_swigregister(S2Point)
class S2PolygonLayerOptions(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    opts = property(_s2geometry.S2PolygonLayerOptions_opts_get, _s2geometry.S2PolygonLayerOptions_opts_set)

    def set_edge_type(self, arg2):
        return _s2geometry.S2PolygonLayerOptions_set_edge_type(self, arg2)

    def __init__(self):
        _s2geometry.S2PolygonLayerOptions_swiginit(self, _s2geometry.new_S2PolygonLayerOptions())
    __swig_destroy__ = _s2geometry.delete_S2PolygonLayerOptions

# Register S2PolygonLayerOptions in _s2geometry:
_s2geometry.S2PolygonLayerOptions_swigregister(S2PolygonLayerOptions)
class S2BufferOperationOptions(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    opts = property(_s2geometry.S2BufferOperationOptions_opts_get, _s2geometry.S2BufferOperationOptions_opts_set)

    def set_buffer_radius(self, arg2):
        return _s2geometry.S2BufferOperationOptions_set_buffer_radius(self, arg2)

    def set_error_fraction(self, arg2):
        return _s2geometry.S2BufferOperationOptions_set_error_fraction(self, arg2)

    def __init__(self):
        _s2geometry.S2BufferOperationOptions_swiginit(self, _s2geometry.new_S2BufferOperationOptions())
    __swig_destroy__ = _s2geometry.delete_S2BufferOperationOptions

# Register S2BufferOperationOptions in _s2geometry:
_s2geometry.S2BufferOperationOptions_swigregister(S2BufferOperationOptions)
class R1Interval(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):
        _s2geometry.R1Interval_swiginit(self, _s2geometry.new_R1Interval(*args))

    def GetLength(self):
        return _s2geometry.R1Interval_GetLength(self)

    def __eq__(self, y):
        return _s2geometry.R1Interval___eq__(self, y)

    def __ne__(self, y):
        return _s2geometry.R1Interval___ne__(self, y)
    __swig_destroy__ = _s2geometry.delete_R1Interval

# Register R1Interval in _s2geometry:
_s2geometry.R1Interval_swigregister(R1Interval)
class S1Angle(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    @staticmethod
    def Radians(radians):
        return _s2geometry.S1Angle_Radians(radians)

    @staticmethod
    def Degrees(degrees):
        return _s2geometry.S1Angle_Degrees(degrees)

    @staticmethod
    def E5(e5):
        return _s2geometry.S1Angle_E5(e5)

    @staticmethod
    def E6(e6):
        return _s2geometry.S1Angle_E6(e6)

    @staticmethod
    def E7(e7):
        return _s2geometry.S1Angle_E7(e7)

    @staticmethod
    def UnsignedE6(e6):
        return _s2geometry.S1Angle_UnsignedE6(e6)

    def __init__(self, *args):
        _s2geometry.S1Angle_swiginit(self, _s2geometry.new_S1Angle(*args))

    def radians(self):
        return _s2geometry.S1Angle_radians(self)

    def degrees(self):
        return _s2geometry.S1Angle_degrees(self)

    def e6(self):
        return _s2geometry.S1Angle_e6(self)

    def e7(self):
        return _s2geometry.S1Angle_e7(self)

    def abs(self):
        return _s2geometry.S1Angle_abs(self)

    def __iadd__(self, a):
        return _s2geometry.S1Angle___iadd__(self, a)

    def __isub__(self, a):
        return _s2geometry.S1Angle___isub__(self, a)

    def __imul__(self, m):
        return _s2geometry.S1Angle___imul__(self, m)

    def __itruediv__(self, *args):
        return _s2geometry.S1Angle___itruediv__(self, *args)
    __idiv__ = __itruediv__



    def Normalized(self):
        return _s2geometry.S1Angle_Normalized(self)

    def Normalize(self):
        return _s2geometry.S1Angle_Normalize(self)

    def __str__(self):
        return _s2geometry.S1Angle___str__(self)

    def __eq__(self, other):
        return _s2geometry.S1Angle___eq__(self, other)

    def __ne__(self, other):
        return _s2geometry.S1Angle___ne__(self, other)

    def __lt__(self, other):
        return _s2geometry.S1Angle___lt__(self, other)

    def __gt__(self, other):
        return _s2geometry.S1Angle___gt__(self, other)
    __swig_destroy__ = _s2geometry.delete_S1Angle

# Register S1Angle in _s2geometry:
_s2geometry.S1Angle_swigregister(S1Angle)
class S1ChordAngle(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    @staticmethod
    def Infinity():
        return _s2geometry.S1ChordAngle_Infinity()

    def ToAngle(self):
        return _s2geometry.S1ChordAngle_ToAngle(self)

    def degrees(self):
        return _s2geometry.S1ChordAngle_degrees(self)

    def __iadd__(self, a):
        return _s2geometry.S1ChordAngle___iadd__(self, a)

    def __isub__(self, a):
        return _s2geometry.S1ChordAngle___isub__(self, a)

    def __eq__(self, other):
        return _s2geometry.S1ChordAngle___eq__(self, other)

    def __ne__(self, other):
        return _s2geometry.S1ChordAngle___ne__(self, other)

    def __lt__(self, other):
        return _s2geometry.S1ChordAngle___lt__(self, other)

    def __gt__(self, other):
        return _s2geometry.S1ChordAngle___gt__(self, other)

    def __add__(self, other):
        return _s2geometry.S1ChordAngle___add__(self, other)

    def __sub__(self, other):
        return _s2geometry.S1ChordAngle___sub__(self, other)

    def __init__(self, *args):
        _s2geometry.S1ChordAngle_swiginit(self, _s2geometry.new_S1ChordAngle(*args))
    __swig_destroy__ = _s2geometry.delete_S1ChordAngle

# Register S1ChordAngle in _s2geometry:
_s2geometry.S1ChordAngle_swigregister(S1ChordAngle)
class S1Interval(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):
        _s2geometry.S1Interval_swiginit(self, _s2geometry.new_S1Interval(*args))

    def GetLength(self):
        return _s2geometry.S1Interval_GetLength(self)

    def __eq__(self, y):
        return _s2geometry.S1Interval___eq__(self, y)

    def __ne__(self, y):
        return _s2geometry.S1Interval___ne__(self, y)

    def __str__(self):
        return _s2geometry.S1Interval___str__(self)
    __swig_destroy__ = _s2geometry.delete_S1Interval

# Register S1Interval in _s2geometry:
_s2geometry.S1Interval_swigregister(S1Interval)
class S2BooleanOperation(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    OpType_UNION = _s2geometry.S2BooleanOperation_OpType_UNION
    OpType_INTERSECTION = _s2geometry.S2BooleanOperation_OpType_INTERSECTION
    OpType_DIFFERENCE = _s2geometry.S2BooleanOperation_OpType_DIFFERENCE
    OpType_SYMMETRIC_DIFFERENCE = _s2geometry.S2BooleanOperation_OpType_SYMMETRIC_DIFFERENCE

    def Build(self, a, b):
        return _s2geometry.S2BooleanOperation_Build(self, a, b)

    def __init__(self, op_type, layer_disown):
        _s2geometry.S2BooleanOperation_swiginit(self, _s2geometry.new_S2BooleanOperation(op_type, layer_disown))
    __swig_destroy__ = _s2geometry.delete_S2BooleanOperation

# Register S2BooleanOperation in _s2geometry:
_s2geometry.S2BooleanOperation_swigregister(S2BooleanOperation)
class S2BufferOperation(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def Build(self):
        return _s2geometry.S2BufferOperation_Build(self)

    def __init__(self, *args):
        _s2geometry.S2BufferOperation_swiginit(self, _s2geometry.new_S2BufferOperation(*args))

    def AddPolygon(self, polygon_disown):
        return _s2geometry.S2BufferOperation_AddPolygon(self, polygon_disown)

    def AddPoint(self, point):
        return _s2geometry.S2BufferOperation_AddPoint(self, point)
    __swig_destroy__ = _s2geometry.delete_S2BufferOperation

# Register S2BufferOperation in _s2geometry:
_s2geometry.S2BufferOperation_swigregister(S2BufferOperation)
class S2Builder(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    EdgeType_DIRECTED = _s2geometry.S2Builder_EdgeType_DIRECTED
    EdgeType_UNDIRECTED = _s2geometry.S2Builder_EdgeType_UNDIRECTED

    def __init__(self, *args):
        _s2geometry.S2Builder_swiginit(self, _s2geometry.new_S2Builder(*args))

    def AddEdge(self, v0, v1):
        return _s2geometry.S2Builder_AddEdge(self, v0, v1)

    def Build(self):
        return _s2geometry.S2Builder_Build(self)

    def StartLayer(self, layer_disown):
        return _s2geometry.S2Builder_StartLayer(self, layer_disown)
    __swig_destroy__ = _s2geometry.delete_S2Builder

# Register S2Builder in _s2geometry:
_s2geometry.S2Builder_swigregister(S2Builder)
class S2PolygonLayer(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):

        self._incref = args[0]


        _s2geometry.S2PolygonLayer_swiginit(self, _s2geometry.new_S2PolygonLayer(*args))
    __swig_destroy__ = _s2geometry.delete_S2PolygonLayer

# Register S2PolygonLayer in _s2geometry:
_s2geometry.S2PolygonLayer_swigregister(S2PolygonLayer)
class S2CellId(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    kMaxLevel = _s2geometry.S2CellId_kMaxLevel

    def __init__(self, *args):
        _s2geometry.S2CellId_swiginit(self, _s2geometry.new_S2CellId(*args))

    @staticmethod
    def FromFacePosLevel(face, pos, level):
        return _s2geometry.S2CellId_FromFacePosLevel(face, pos, level)

    def ToPoint(self):
        return _s2geometry.S2CellId_ToPoint(self)

    def GetCenterSiTi(self):
        return _s2geometry.S2CellId_GetCenterSiTi(self)

    def ToLatLng(self):
        return _s2geometry.S2CellId_ToLatLng(self)

    def id(self):
        return _s2geometry.S2CellId_id(self)

    def is_valid(self):
        return _s2geometry.S2CellId_is_valid(self)

    def face(self):
        return _s2geometry.S2CellId_face(self)

    def pos(self):
        return _s2geometry.S2CellId_pos(self)

    def level(self):

          # As in the C++ version:
          # We can't just check is_valid() because we want level() to be
          # defined for end-iterators, i.e. S2CellId.End(level).  However there is
          # no good way to define S2CellId::None().level(), so we do prohibit that.
        if self.id() == 0:
          raise ValueError("None has no level.")


        return _s2geometry.S2CellId_level(self)


    def is_leaf(self):
        return _s2geometry.S2CellId_is_leaf(self)

    def is_face(self):
        return _s2geometry.S2CellId_is_face(self)

    def child_position(self, level):

        if not self.is_valid():
          raise ValueError("S2CellId must be valid.")
        if level < 1 or level > self.level():
          raise ValueError("level must must be in range [1, S2 cell level]")


        return _s2geometry.S2CellId_child_position(self, level)


    def range_min(self):
        return _s2geometry.S2CellId_range_min(self)

    def range_max(self):
        return _s2geometry.S2CellId_range_max(self)

    def contains(self, other):

        if not self.is_valid() or not other.is_valid():
          raise ValueError("Both S2CellIds must be valid.")


        return _s2geometry.S2CellId_contains(self, other)


    def intersects(self, other):

        if not self.is_valid() or not other.is_valid():
          raise ValueError("Both S2CellIds must be valid.")


        return _s2geometry.S2CellId_intersects(self, other)


    def parent(self, *args):

        if not self.is_valid():
          raise ValueError("S2CellId must be valid.")
        if len(args) == 1:
          level, = args
          if level < 0:
            raise ValueError("Level must be non-negative.")
          if level > self.level():
            raise ValueError("Level must be less than or equal to cell's level.")


        return _s2geometry.S2CellId_parent(self, *args)


    def child(self, position):

        if not self.is_valid():
          raise ValueError("S2CellId must be valid.")
        if self.is_leaf():
          raise ValueError("S2CellId must be non-leaf.")

        if not 0 <= position < 4:
          raise ValueError("Position must be 0-3.")


        return _s2geometry.S2CellId_child(self, position)


    def child_begin(self, *args):
        return _s2geometry.S2CellId_child_begin(self, *args)

    def child_end(self, *args):
        return _s2geometry.S2CellId_child_end(self, *args)

    def next(self):
        return _s2geometry.S2CellId_next(self)

    def prev(self):
        return _s2geometry.S2CellId_prev(self)

    @staticmethod
    def Begin(level):
        return _s2geometry.S2CellId_Begin(level)

    @staticmethod
    def End(level):
        return _s2geometry.S2CellId_End(level)

    def ToToken(self):
        return _s2geometry.S2CellId_ToToken(self)

    @staticmethod
    def FromToken(token):
        return _s2geometry.S2CellId_FromToken(token)

    def ToString(self):
        return _s2geometry.S2CellId_ToString(self)

    @staticmethod
    def FromDebugString(str):
        return _s2geometry.S2CellId_FromDebugString(str)

    def GetEdgeNeighbors(self):
        return _s2geometry.S2CellId_GetEdgeNeighbors(self)

    def GetVertexNeighbors(self, level):
        return _s2geometry.S2CellId_GetVertexNeighbors(self, level)

    def GetAllNeighbors(self, nbr_level):
        return _s2geometry.S2CellId_GetAllNeighbors(self, nbr_level)

    @staticmethod
    def FromFaceIJ(face, i, j):
        return _s2geometry.S2CellId_FromFaceIJ(face, i, j)

    def ToFaceIJOrientation(self):
        return _s2geometry.S2CellId_ToFaceIJOrientation(self)

    def __str__(self):
        return _s2geometry.S2CellId___str__(self)

    def __eq__(self, other):
        return _s2geometry.S2CellId___eq__(self, other)

    def __ne__(self, other):
        return _s2geometry.S2CellId___ne__(self, other)

    def __lt__(self, other):
        return _s2geometry.S2CellId___lt__(self, other)

    def __gt__(self, other):
        return _s2geometry.S2CellId___gt__(self, other)

    def __hash__(self):
        return _s2geometry.S2CellId___hash__(self)
    __swig_destroy__ = _s2geometry.delete_S2CellId

# Register S2CellId in _s2geometry:
_s2geometry.S2CellId_swigregister(S2CellId)

def CrossingSign(a, b, c, d):
    return _s2geometry.CrossingSign(a, b, c, d)

def GetIntersection(a, b, c, d):
    return _s2geometry.GetIntersection(a, b, c, d)

def UpdateMinDistance(x, a, b, min_dist):
    return _s2geometry.UpdateMinDistance(x, a, b, min_dist)

def Interpolate(a, b, t):
    return _s2geometry.Interpolate(a, b, t)
class S2Earth(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    @staticmethod
    def MetersToRadians(meters):
        return _s2geometry.S2Earth_MetersToRadians(meters)

    @staticmethod
    def ToMeters(*args):
        return _s2geometry.S2Earth_ToMeters(*args)

    @staticmethod
    def RadiansToMeters(radians):
        return _s2geometry.S2Earth_RadiansToMeters(radians)

    @staticmethod
    def KmToRadians(km):
        return _s2geometry.S2Earth_KmToRadians(km)

    @staticmethod
    def ToKm(*args):
        return _s2geometry.S2Earth_ToKm(*args)

    @staticmethod
    def RadiansToKm(radians):
        return _s2geometry.S2Earth_RadiansToKm(radians)

    @staticmethod
    def ToAngle(distance):
        return _s2geometry.S2Earth_ToAngle(distance)

    @staticmethod
    def ToChordAngle(distance):
        return _s2geometry.S2Earth_ToChordAngle(distance)

    @staticmethod
    def ToRadians(distance):
        return _s2geometry.S2Earth_ToRadians(distance)

    @staticmethod
    def ToDistance(*args):
        return _s2geometry.S2Earth_ToDistance(*args)

    @staticmethod
    def SquareKmToSteradians(km2):
        return _s2geometry.S2Earth_SquareKmToSteradians(km2)

    @staticmethod
    def SquareMetersToSteradians(m2):
        return _s2geometry.S2Earth_SquareMetersToSteradians(m2)

    @staticmethod
    def SteradiansToSquareKm(steradians):
        return _s2geometry.S2Earth_SteradiansToSquareKm(steradians)

    @staticmethod
    def SteradiansToSquareMeters(steradians):
        return _s2geometry.S2Earth_SteradiansToSquareMeters(steradians)

    @staticmethod
    def ToLongitudeRadians(distance, latitude_radians):
        return _s2geometry.S2Earth_ToLongitudeRadians(distance, latitude_radians)

    @staticmethod
    def GetInitialBearing(a, b):
        return _s2geometry.S2Earth_GetInitialBearing(a, b)

    @staticmethod
    def GetDistanceMeters(*args):
        return _s2geometry.S2Earth_GetDistanceMeters(*args)

    @staticmethod
    def GetDistanceKm(*args):
        return _s2geometry.S2Earth_GetDistanceKm(*args)

    @staticmethod
    def GetDistance(*args):
        return _s2geometry.S2Earth_GetDistance(*args)

    @staticmethod
    def RadiusMeters():
        return _s2geometry.S2Earth_RadiusMeters()

    @staticmethod
    def RadiusKm():
        return _s2geometry.S2Earth_RadiusKm()

    @staticmethod
    def Radius():
        return _s2geometry.S2Earth_Radius()

    @staticmethod
    def LowestAltitudeMeters():
        return _s2geometry.S2Earth_LowestAltitudeMeters()

    @staticmethod
    def HighestAltitudeMeters():
        return _s2geometry.S2Earth_HighestAltitudeMeters()

    def __init__(self):
        _s2geometry.S2Earth_swiginit(self, _s2geometry.new_S2Earth())
    __swig_destroy__ = _s2geometry.delete_S2Earth

# Register S2Earth in _s2geometry:
_s2geometry.S2Earth_swigregister(S2Earth)
class S2Cap(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):
        _s2geometry.S2Cap_swiginit(self, _s2geometry.new_S2Cap(*args))

    @staticmethod
    def FromPoint(center):
        return _s2geometry.S2Cap_FromPoint(center)

    @staticmethod
    def FromCenterHeight(center, height):
        return _s2geometry.S2Cap_FromCenterHeight(center, height)

    @staticmethod
    def FromCenterArea(center, area):
        return _s2geometry.S2Cap_FromCenterArea(center, area)

    @staticmethod
    def Empty():
        return _s2geometry.S2Cap_Empty()

    @staticmethod
    def Full():
        return _s2geometry.S2Cap_Full()
    __swig_destroy__ = _s2geometry.delete_S2Cap

    def center(self):
        return _s2geometry.S2Cap_center(self)

    def height(self):
        return _s2geometry.S2Cap_height(self)

    def GetCentroid(self):
        return _s2geometry.S2Cap_GetCentroid(self)

    def is_valid(self):
        return _s2geometry.S2Cap_is_valid(self)

    def is_empty(self):
        return _s2geometry.S2Cap_is_empty(self)

    def Intersects(self, other):
        return _s2geometry.S2Cap_Intersects(self, other)

    def AddPoint(self, p):
        return _s2geometry.S2Cap_AddPoint(self, p)

    def Expanded(self, distance):
        return _s2geometry.S2Cap_Expanded(self, distance)

    def Union(self, other):
        return _s2geometry.S2Cap_Union(self, other)

    def Clone(self):
        return _s2geometry.S2Cap_Clone(self)

    def GetCapBound(self):
        return _s2geometry.S2Cap_GetCapBound(self)

    def GetRectBound(self):
        return _s2geometry.S2Cap_GetRectBound(self)

    def MayIntersect(self, cell):
        return _s2geometry.S2Cap_MayIntersect(self, cell)

    def Contains(self, *args):
        return _s2geometry.S2Cap_Contains(self, *args)

    def Encode(self, encoder):
        return _s2geometry.S2Cap_Encode(self, encoder)

    def Decode(self, decoder):
        return _s2geometry.S2Cap_Decode(self, decoder)

    def __eq__(self, other):
        return _s2geometry.S2Cap___eq__(self, other)

    def __ne__(self, other):
        return _s2geometry.S2Cap___ne__(self, other)

    def ApproxEquals(self, *args):
        return _s2geometry.S2Cap_ApproxEquals(self, *args)

    def __str__(self):
        return _s2geometry.S2Cap___str__(self)

# Register S2Cap in _s2geometry:
_s2geometry.S2Cap_swigregister(S2Cap)
class S2LatLng(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):
        _s2geometry.S2LatLng_swiginit(self, _s2geometry.new_S2LatLng(*args))

    @staticmethod
    def FromRadians(lat_radians, lng_radians):
        return _s2geometry.S2LatLng_FromRadians(lat_radians, lng_radians)

    @staticmethod
    def FromDegrees(lat_degrees, lng_degrees):
        return _s2geometry.S2LatLng_FromDegrees(lat_degrees, lng_degrees)

    @staticmethod
    def FromE6(lat_e6, lng_e6):
        return _s2geometry.S2LatLng_FromE6(lat_e6, lng_e6)

    @staticmethod
    def FromE7(lat_e7, lng_e7):
        return _s2geometry.S2LatLng_FromE7(lat_e7, lng_e7)

    @staticmethod
    def FromUnsignedE6(lat_e6, lng_e6):
        return _s2geometry.S2LatLng_FromUnsignedE6(lat_e6, lng_e6)

    @staticmethod
    def FromUnsignedE7(lat_e7, lng_e7):
        return _s2geometry.S2LatLng_FromUnsignedE7(lat_e7, lng_e7)

    def lat(self):
        return _s2geometry.S2LatLng_lat(self)

    def lng(self):
        return _s2geometry.S2LatLng_lng(self)

    def coords(self):
        return _s2geometry.S2LatLng_coords(self)

    def is_valid(self):
        return _s2geometry.S2LatLng_is_valid(self)

    def Normalized(self):
        return _s2geometry.S2LatLng_Normalized(self)

    def ToPoint(self):
        return _s2geometry.S2LatLng_ToPoint(self)

    def GetDistance(self, o):
        return _s2geometry.S2LatLng_GetDistance(self, o)

    def __eq__(self, o):
        return _s2geometry.S2LatLng___eq__(self, o)

    def __ne__(self, o):
        return _s2geometry.S2LatLng___ne__(self, o)

    def __lt__(self, o):
        return _s2geometry.S2LatLng___lt__(self, o)

    def __gt__(self, o):
        return _s2geometry.S2LatLng___gt__(self, o)

    def __le__(self, o):
        return _s2geometry.S2LatLng___le__(self, o)

    def __ge__(self, o):
        return _s2geometry.S2LatLng___ge__(self, o)

    def ApproxEquals(self, *args):
        return _s2geometry.S2LatLng_ApproxEquals(self, *args)

    def ToStringInDegrees(self):
        return _s2geometry.S2LatLng_ToStringInDegrees(self)

    def __str__(self):
        return _s2geometry.S2LatLng___str__(self)
    __swig_destroy__ = _s2geometry.delete_S2LatLng

# Register S2LatLng in _s2geometry:
_s2geometry.S2LatLng_swigregister(S2LatLng)
class S2LatLngRect(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):
        _s2geometry.S2LatLngRect_swiginit(self, _s2geometry.new_S2LatLngRect(*args))

    @staticmethod
    def FromCenterSize(center, size):
        return _s2geometry.S2LatLngRect_FromCenterSize(center, size)

    @staticmethod
    def FromPoint(p):
        return _s2geometry.S2LatLngRect_FromPoint(p)

    @staticmethod
    def FromPointPair(p1, p2):
        return _s2geometry.S2LatLngRect_FromPointPair(p1, p2)

    def lat_lo(self):
        return _s2geometry.S2LatLngRect_lat_lo(self)

    def lat_hi(self):
        return _s2geometry.S2LatLngRect_lat_hi(self)

    def lng_lo(self):
        return _s2geometry.S2LatLngRect_lng_lo(self)

    def lng_hi(self):
        return _s2geometry.S2LatLngRect_lng_hi(self)

    def lat(self):
        return _s2geometry.S2LatLngRect_lat(self)

    def lng(self):
        return _s2geometry.S2LatLngRect_lng(self)

    def lo(self):
        return _s2geometry.S2LatLngRect_lo(self)

    def hi(self):
        return _s2geometry.S2LatLngRect_hi(self)

    @staticmethod
    def Empty():
        return _s2geometry.S2LatLngRect_Empty()

    @staticmethod
    def Full():
        return _s2geometry.S2LatLngRect_Full()

    def is_valid(self):
        return _s2geometry.S2LatLngRect_is_valid(self)

    def is_empty(self):
        return _s2geometry.S2LatLngRect_is_empty(self)

    def is_point(self):
        return _s2geometry.S2LatLngRect_is_point(self)

    def GetVertex(self, k):
        return _s2geometry.S2LatLngRect_GetVertex(self, k)

    def GetCenter(self):
        return _s2geometry.S2LatLngRect_GetCenter(self)

    def GetSize(self):
        return _s2geometry.S2LatLngRect_GetSize(self)

    def Area(self):
        return _s2geometry.S2LatLngRect_Area(self)

    def GetCentroid(self):
        return _s2geometry.S2LatLngRect_GetCentroid(self)

    def Intersects(self, *args):
        return _s2geometry.S2LatLngRect_Intersects(self, *args)

    def AddPoint(self, *args):
        return _s2geometry.S2LatLngRect_AddPoint(self, *args)

    def Union(self, other):
        return _s2geometry.S2LatLngRect_Union(self, other)

    def Intersection(self, other):
        return _s2geometry.S2LatLngRect_Intersection(self, other)

    def ExpandedByDistance(self, distance):
        return _s2geometry.S2LatLngRect_ExpandedByDistance(self, distance)

    def GetDistance(self, *args):
        return _s2geometry.S2LatLngRect_GetDistance(self, *args)

    def __eq__(self, other):
        return _s2geometry.S2LatLngRect___eq__(self, other)

    def __ne__(self, other):
        return _s2geometry.S2LatLngRect___ne__(self, other)

    def ApproxEquals(self, *args):
        return _s2geometry.S2LatLngRect_ApproxEquals(self, *args)

    def Clone(self):
        return _s2geometry.S2LatLngRect_Clone(self)

    def GetCapBound(self):
        return _s2geometry.S2LatLngRect_GetCapBound(self)

    def GetRectBound(self):
        return _s2geometry.S2LatLngRect_GetRectBound(self)

    def MayIntersect(self, cell):
        return _s2geometry.S2LatLngRect_MayIntersect(self, cell)

    def Contains(self, *args):
        return _s2geometry.S2LatLngRect_Contains(self, *args)

    def Encode(self, encoder):
        return _s2geometry.S2LatLngRect_Encode(self, encoder)

    def Decode(self, decoder):
        return _s2geometry.S2LatLngRect_Decode(self, decoder)

    def __str__(self):
        return _s2geometry.S2LatLngRect___str__(self)
    __swig_destroy__ = _s2geometry.delete_S2LatLngRect

# Register S2LatLngRect in _s2geometry:
_s2geometry.S2LatLngRect_swigregister(S2LatLngRect)
class S2Loop(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    __swig_destroy__ = _s2geometry.delete_S2Loop

    def IsValid(self):
        return _s2geometry.S2Loop_IsValid(self)

    def num_vertices(self):
        return _s2geometry.S2Loop_num_vertices(self)

    def vertex(self, i):
        return _s2geometry.S2Loop_vertex(self, i)

    def is_empty(self):
        return _s2geometry.S2Loop_is_empty(self)

    def depth(self):
        return _s2geometry.S2Loop_depth(self)

    def is_hole(self):
        return _s2geometry.S2Loop_is_hole(self)

    def sign(self):
        return _s2geometry.S2Loop_sign(self)

    def IsNormalized(self):
        return _s2geometry.S2Loop_IsNormalized(self)

    def Normalize(self):
        return _s2geometry.S2Loop_Normalize(self)

    def GetArea(self):
        return _s2geometry.S2Loop_GetArea(self)

    def GetCentroid(self):
        return _s2geometry.S2Loop_GetCentroid(self)

    def GetDistance(self, x):
        return _s2geometry.S2Loop_GetDistance(self, x)

    def Project(self, x):
        return _s2geometry.S2Loop_Project(self, x)

    def Intersects(self, b):
        return _s2geometry.S2Loop_Intersects(self, b)

    def Equals(self, b):
        return _s2geometry.S2Loop_Equals(self, b)

    def Clone(self):
        return _s2geometry.S2Loop_Clone(self)

    def GetCapBound(self):
        return _s2geometry.S2Loop_GetCapBound(self)

    def GetRectBound(self):
        return _s2geometry.S2Loop_GetRectBound(self)

    def MayIntersect(self, cell):
        return _s2geometry.S2Loop_MayIntersect(self, cell)

    def Contains(self, *args):
        return _s2geometry.S2Loop_Contains(self, *args)

    def Encode(self, encoder):
        return _s2geometry.S2Loop_Encode(self, encoder)

    def Decode(self, decoder):
        return _s2geometry.S2Loop_Decode(self, decoder)

    def GetS2LatLngVertex(self, i):
        return _s2geometry.S2Loop_GetS2LatLngVertex(self, i)

    def __init__(self, *args):
        _s2geometry.S2Loop_swiginit(self, _s2geometry.new_S2Loop(*args))

    def Init(self, vertices):
        return _s2geometry.S2Loop_Init(self, vertices)

    def __eq__(self, other):
        return _s2geometry.S2Loop___eq__(self, other)

    def __ne__(self, other):
        return _s2geometry.S2Loop___ne__(self, other)

# Register S2Loop in _s2geometry:
_s2geometry.S2Loop_swigregister(S2Loop)

def TurnAngle(a, b, c):
    return _s2geometry.TurnAngle(a, b, c)

def Rotate(p, axis, angle):
    return _s2geometry.Rotate(p, axis, angle)
class S2Polygon(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def Copy(self, src):
        return _s2geometry.S2Polygon_Copy(self, src)
    __swig_destroy__ = _s2geometry.delete_S2Polygon

    def IsValid(self):
        return _s2geometry.S2Polygon_IsValid(self)

    def is_empty(self):
        return _s2geometry.S2Polygon_is_empty(self)

    def num_loops(self):
        return _s2geometry.S2Polygon_num_loops(self)

    def num_vertices(self):
        return _s2geometry.S2Polygon_num_vertices(self)

    def loop(self, *args):
        return _s2geometry.S2Polygon_loop(self, *args)

    def GetLastDescendant(self, k):
        return _s2geometry.S2Polygon_GetLastDescendant(self, k)

    def GetArea(self):
        return _s2geometry.S2Polygon_GetArea(self)

    def GetCentroid(self):
        return _s2geometry.S2Polygon_GetCentroid(self)

    def GetDistance(self, x):
        return _s2geometry.S2Polygon_GetDistance(self, x)

    @staticmethod
    def GetOverlapFractions(a, b):
        return _s2geometry.S2Polygon_GetOverlapFractions(a, b)

    def Project(self, x):
        return _s2geometry.S2Polygon_Project(self, x)

    def InitToUnion(self, *args):
        return _s2geometry.S2Polygon_InitToUnion(self, *args)

    def Intersects(self, *args):
        return _s2geometry.S2Polygon_Intersects(self, *args)

    def Equals(self, b):
        return _s2geometry.S2Polygon_Equals(self, b)

    def BoundaryNear(self, *args):
        return _s2geometry.S2Polygon_BoundaryNear(self, *args)

    def Clone(self):
        return _s2geometry.S2Polygon_Clone(self)

    def GetCapBound(self):
        return _s2geometry.S2Polygon_GetCapBound(self)

    def GetRectBound(self):
        return _s2geometry.S2Polygon_GetRectBound(self)

    def MayIntersect(self, cell):
        return _s2geometry.S2Polygon_MayIntersect(self, cell)

    def Contains(self, *args):
        return _s2geometry.S2Polygon_Contains(self, *args)

    def Encode(self, *args):
        return _s2geometry.S2Polygon_Encode(self, *args)

    def Decode(self, decoder):
        return _s2geometry.S2Polygon_Decode(self, decoder)

    def __init__(self, *args):
        _s2geometry.S2Polygon_swiginit(self, _s2geometry.new_S2Polygon(*args))

    def InitNested(self, loops):
        return _s2geometry.S2Polygon_InitNested(self, loops)

    def IntersectWithPolyline(self, _in):
        return _s2geometry.S2Polygon_IntersectWithPolyline(self, _in)

    def __eq__(self, other):
        return _s2geometry.S2Polygon___eq__(self, other)

    def __ne__(self, other):
        return _s2geometry.S2Polygon___ne__(self, other)

# Register S2Polygon in _s2geometry:
_s2geometry.S2Polygon_swigregister(S2Polygon)
class S2Polyline(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):
        _s2geometry.S2Polyline_swiginit(self, _s2geometry.new_S2Polyline(*args))
    __swig_destroy__ = _s2geometry.delete_S2Polyline

    def IsValid(self):
        return _s2geometry.S2Polyline_IsValid(self)

    def num_vertices(self):
        return _s2geometry.S2Polyline_num_vertices(self)

    def vertex(self, k):
        return _s2geometry.S2Polyline_vertex(self, k)

    def GetLength(self):
        return _s2geometry.S2Polyline_GetLength(self)

    def GetCentroid(self):
        return _s2geometry.S2Polyline_GetCentroid(self)

    def Interpolate(self, fraction):
        return _s2geometry.S2Polyline_Interpolate(self, fraction)

    def GetSuffix(self, fraction):
        return _s2geometry.S2Polyline_GetSuffix(self, fraction)

    def UnInterpolate(self, point, next_vertex):
        return _s2geometry.S2Polyline_UnInterpolate(self, point, next_vertex)

    def Project(self, point):
        return _s2geometry.S2Polyline_Project(self, point)

    def IsOnRight(self, point):
        return _s2geometry.S2Polyline_IsOnRight(self, point)

    def Intersects(self, line):
        return _s2geometry.S2Polyline_Intersects(self, line)

    def Reverse(self):
        return _s2geometry.S2Polyline_Reverse(self)

    def ApproxEquals(self, *args):
        return _s2geometry.S2Polyline_ApproxEquals(self, *args)

    def Clone(self):
        return _s2geometry.S2Polyline_Clone(self)

    def GetCapBound(self):
        return _s2geometry.S2Polyline_GetCapBound(self)

    def GetRectBound(self):
        return _s2geometry.S2Polyline_GetRectBound(self)

    def MayIntersect(self, cell):
        return _s2geometry.S2Polyline_MayIntersect(self, cell)

    def Contains(self, *args):
        return _s2geometry.S2Polyline_Contains(self, *args)

    def Encode(self, *args):
        return _s2geometry.S2Polyline_Encode(self, *args)

    def Decode(self, decoder):
        return _s2geometry.S2Polyline_Decode(self, decoder)

    def InitFromS2LatLngs(self, vertices):
        return _s2geometry.S2Polyline_InitFromS2LatLngs(self, vertices)

    def InitFromS2Points(self, vertices):
        return _s2geometry.S2Polyline_InitFromS2Points(self, vertices)

    def __eq__(self, other):
        return _s2geometry.S2Polyline___eq__(self, other)

    def __ne__(self, other):
        return _s2geometry.S2Polyline___ne__(self, other)

# Register S2Polyline in _s2geometry:
_s2geometry.S2Polyline_swigregister(S2Polyline)

def OrderedCCW(a, b, c, o):
    return _s2geometry.OrderedCCW(a, b, c, o)

def __lshift__(os, excluded):
    return _s2geometry.__lshift__(os, excluded)
class S2RegionCoverer(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self):
        _s2geometry.S2RegionCoverer_swiginit(self, _s2geometry.new_S2RegionCoverer())
    __swig_destroy__ = _s2geometry.delete_S2RegionCoverer

    def GetCovering(self, region):
        return _s2geometry.S2RegionCoverer_GetCovering(self, region)

    def GetInteriorCovering(self, region):
        return _s2geometry.S2RegionCoverer_GetInteriorCovering(self, region)

    def max_cells(self):
        return _s2geometry.S2RegionCoverer_max_cells(self)

    def set_max_cells(self, max_cells):
        return _s2geometry.S2RegionCoverer_set_max_cells(self, max_cells)

    def min_level(self):
        return _s2geometry.S2RegionCoverer_min_level(self)

    def set_min_level(self, min_level):
        return _s2geometry.S2RegionCoverer_set_min_level(self, min_level)

    def max_level(self):
        return _s2geometry.S2RegionCoverer_max_level(self)

    def set_max_level(self, max_level):
        return _s2geometry.S2RegionCoverer_set_max_level(self, max_level)

    def set_fixed_level(self, fixed_level):
        return _s2geometry.S2RegionCoverer_set_fixed_level(self, fixed_level)

    def level_mod(self):
        return _s2geometry.S2RegionCoverer_level_mod(self)

    def set_level_mod(self, level_mod):
        return _s2geometry.S2RegionCoverer_set_level_mod(self, level_mod)

    def true_max_level(self):
        return _s2geometry.S2RegionCoverer_true_max_level(self)

# Register S2RegionCoverer in _s2geometry:
_s2geometry.S2RegionCoverer_swigregister(S2RegionCoverer)
class S2RegionTermIndexer(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    __swig_destroy__ = _s2geometry.delete_S2RegionTermIndexer

    def __init__(self, *args):
        _s2geometry.S2RegionTermIndexer_swiginit(self, _s2geometry.new_S2RegionTermIndexer(*args))

    def GetIndexTerms(self, *args):
        return _s2geometry.S2RegionTermIndexer_GetIndexTerms(self, *args)

    def GetQueryTerms(self, *args):
        return _s2geometry.S2RegionTermIndexer_GetQueryTerms(self, *args)

    def GetIndexTermsForCanonicalCovering(self, covering, prefix):
        return _s2geometry.S2RegionTermIndexer_GetIndexTermsForCanonicalCovering(self, covering, prefix)

    def GetQueryTermsForCanonicalCovering(self, covering, prefix):
        return _s2geometry.S2RegionTermIndexer_GetQueryTermsForCanonicalCovering(self, covering, prefix)

    def max_cells(self):
        return _s2geometry.S2RegionTermIndexer_max_cells(self)

    def set_max_cells(self, max_cells):
        return _s2geometry.S2RegionTermIndexer_set_max_cells(self, max_cells)

    def min_level(self):
        return _s2geometry.S2RegionTermIndexer_min_level(self)

    def set_min_level(self, min_level):
        return _s2geometry.S2RegionTermIndexer_set_min_level(self, min_level)

    def max_level(self):
        return _s2geometry.S2RegionTermIndexer_max_level(self)

    def set_max_level(self, max_level):
        return _s2geometry.S2RegionTermIndexer_set_max_level(self, max_level)

    def set_fixed_level(self, fixed_level):
        return _s2geometry.S2RegionTermIndexer_set_fixed_level(self, fixed_level)

    def level_mod(self):
        return _s2geometry.S2RegionTermIndexer_level_mod(self)

    def set_level_mod(self, level_mod):
        return _s2geometry.S2RegionTermIndexer_set_level_mod(self, level_mod)

    def true_max_level(self):
        return _s2geometry.S2RegionTermIndexer_true_max_level(self)

    def index_contains_points_only(self):
        return _s2geometry.S2RegionTermIndexer_index_contains_points_only(self)

    def set_index_contains_points_only(self, value):
        return _s2geometry.S2RegionTermIndexer_set_index_contains_points_only(self, value)

    def optimize_for_space(self):
        return _s2geometry.S2RegionTermIndexer_optimize_for_space(self)

    def set_optimize_for_space(self, value):
        return _s2geometry.S2RegionTermIndexer_set_optimize_for_space(self, value)

    def marker_character(self):
        return _s2geometry.S2RegionTermIndexer_marker_character(self)

    def set_marker_character(self, ch):
        return _s2geometry.S2RegionTermIndexer_set_marker_character(self, ch)

# Register S2RegionTermIndexer in _s2geometry:
_s2geometry.S2RegionTermIndexer_swigregister(S2RegionTermIndexer)
class S2Cell(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):
        _s2geometry.S2Cell_swiginit(self, _s2geometry.new_S2Cell(*args))

    def id(self):
        return _s2geometry.S2Cell_id(self)

    def face(self):
        return _s2geometry.S2Cell_face(self)

    def level(self):
        return _s2geometry.S2Cell_level(self)

    def GetVertex(self, k):
        return _s2geometry.S2Cell_GetVertex(self, k)

    def GetCenter(self):
        return _s2geometry.S2Cell_GetCenter(self)

    def AverageArea(self, *args):
        return _s2geometry.S2Cell_AverageArea(self, *args)

    def ApproxArea(self):
        return _s2geometry.S2Cell_ApproxArea(self)

    def ExactArea(self):
        return _s2geometry.S2Cell_ExactArea(self)

    def GetBoundaryDistance(self, target):
        return _s2geometry.S2Cell_GetBoundaryDistance(self, target)

    def GetDistance(self, *args):
        return _s2geometry.S2Cell_GetDistance(self, *args)

    def Clone(self):
        return _s2geometry.S2Cell_Clone(self)

    def GetCapBound(self):
        return _s2geometry.S2Cell_GetCapBound(self)

    def GetRectBound(self):
        return _s2geometry.S2Cell_GetRectBound(self)

    def MayIntersect(self, cell):
        return _s2geometry.S2Cell_MayIntersect(self, cell)

    def Contains(self, *args):
        return _s2geometry.S2Cell_Contains(self, *args)

    def Encode(self, encoder):
        return _s2geometry.S2Cell_Encode(self, encoder)

    def Decode(self, decoder):
        return _s2geometry.S2Cell_Decode(self, decoder)

    def GetS2LatLngVertex(self, k):
        return _s2geometry.S2Cell_GetS2LatLngVertex(self, k)

    def GetS2LatLngEdge(self, k):
        return _s2geometry.S2Cell_GetS2LatLngEdge(self, k)
    __swig_destroy__ = _s2geometry.delete_S2Cell

# Register S2Cell in _s2geometry:
_s2geometry.S2Cell_swigregister(S2Cell)
class S2CellUnion(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def __init__(self, *args):
        _s2geometry.S2CellUnion_swiginit(self, _s2geometry.new_S2CellUnion(*args))

    @staticmethod
    def FromNormalized(cell_ids):
        return _s2geometry.S2CellUnion_FromNormalized(cell_ids)

    def Init(self, cell_ids):
        return _s2geometry.S2CellUnion_Init(self, cell_ids)

    def num_cells(self):
        return _s2geometry.S2CellUnion_num_cells(self)

    def cell_id(self, i):
        return _s2geometry.S2CellUnion_cell_id(self, i)

    def empty(self):
        return _s2geometry.S2CellUnion_empty(self)

    def cell_ids(self):
        return _s2geometry.S2CellUnion_cell_ids(self)

    def IsNormalized(self):
        return _s2geometry.S2CellUnion_IsNormalized(self)

    def NormalizeS2CellUnion(self):
        return _s2geometry.S2CellUnion_NormalizeS2CellUnion(self)

    def Denormalize(self, min_level, level_mod):
        return _s2geometry.S2CellUnion_Denormalize(self, min_level, level_mod)

    def Intersects(self, *args):
        return _s2geometry.S2CellUnion_Intersects(self, *args)

    def Intersection(self, *args):
        return _s2geometry.S2CellUnion_Intersection(self, *args)

    def ApproxArea(self):
        return _s2geometry.S2CellUnion_ApproxArea(self)

    def ExactArea(self):
        return _s2geometry.S2CellUnion_ExactArea(self)

    def Clone(self):
        return _s2geometry.S2CellUnion_Clone(self)

    def GetCapBound(self):
        return _s2geometry.S2CellUnion_GetCapBound(self)

    def GetRectBound(self):
        return _s2geometry.S2CellUnion_GetRectBound(self)

    def MayIntersect(self, cell):
        return _s2geometry.S2CellUnion_MayIntersect(self, cell)

    def Contains(self, *args):
        return _s2geometry.S2CellUnion_Contains(self, *args)

    def Encode(self, encoder):
        return _s2geometry.S2CellUnion_Encode(self, encoder)

    def Decode(self, decoder):
        return _s2geometry.S2CellUnion_Decode(self, decoder)

    @staticmethod
    def Normalize(cell_ids):
        return _s2geometry.S2CellUnion_Normalize(cell_ids)
    __swig_destroy__ = _s2geometry.delete_S2CellUnion

# Register S2CellUnion in _s2geometry:
_s2geometry.S2CellUnion_swigregister(S2CellUnion)
class S2ShapeIndex(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined - class is abstract")
    __repr__ = _swig_repr

# Register S2ShapeIndex in _s2geometry:
_s2geometry.S2ShapeIndex_swigregister(S2ShapeIndex)
class MutableS2ShapeIndex(S2ShapeIndex):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr
    __swig_destroy__ = _s2geometry.delete_MutableS2ShapeIndex

    def __init__(self, *args):
        _s2geometry.MutableS2ShapeIndex_swiginit(self, _s2geometry.new_MutableS2ShapeIndex(*args))

    def Add(self, polygon_disown):
        return _s2geometry.MutableS2ShapeIndex_Add(self, polygon_disown)

# Register MutableS2ShapeIndex in _s2geometry:
_s2geometry.MutableS2ShapeIndex_swigregister(MutableS2ShapeIndex)

import random

class S2Testing(object):
  """ Simple implementation of key S2Testing methods. """
  _rnd = random.Random(1)

  @classmethod
  def RandomPoint(cls):
    """ Return a random unit-length vector. """
    x = cls._rnd.uniform(-1, 1)
    y = cls._rnd.uniform(-1, 1)
    z = cls._rnd.uniform(-1, 1)
    return S2Point_FromRaw(x, y, z).Normalize()

  @classmethod
  def GetRandomCap(cls, min_area, max_area):
    """
    Return a cap with a random axis such that the log of its area is
    uniformly distributed between the logs of the two given values.
    (The log of the cap angle is also approximately uniformly distributed.)
    """
    cap_area = max_area * pow(min_area / max_area, cls._rnd.random())
    assert cap_area >= min_area
    assert cap_area <= max_area

# The surface area of a cap is 2*Pi times its height.
    return S2Cap.FromCenterArea(cls.RandomPoint(), cap_area)


