The default constructor yields an invalid snap function. You must set the exponent explicitly before using it.
Convenience constructor equivalent to calling set_exponent(exponent).
For IntLatLng snapping, the minimum separation between edges and non-incident vertices depends on level() and snap_radius(). It can be as low as 0.222 * snap_radius(), but is typically 0.39 * snap_radius() or more.
For IntLatLng snapping, the minimum separation between vertices depends on exponent() and snap_radius(). It can vary between snap_radius() and snap_radius().
Snaps vertices to points whose (lat, lng) coordinates are integers after converting to degrees and multiplying by 10 raised to the given exponent. For example, (exponent == 7) yields E7 coordinates. As a side effect, this method also resets "snap_radius" to the minimum value allowed for this exponent:
Defines the snap radius to be used (see s2builder.h). The snap radius must be at least the minimum value for the current exponent(), but larger values can also be used (e.g., to simplify the geometry).
Returns the minimum exponent such that vertices will not move by more than "snap_radius". This can be useful when choosing an appropriate exponent for snapping. The return value is always a valid exponent (out of range values are silently clamped).
The maximum exponent supported for snapping.
The minum exponent supported for snapping.
The maximum distance that vertices can move when snapped.
The maximum snap radius is just large enough to support snapping to S2CellId level 0. It is equivalent to 7800km on the Earth's surface.
The maximum distance that the center of an edge can move when snapped. This is slightly larger than "snap_radius" because when a geodesic edge is snapped, the center of the edge moves further than its endpoints.
The guaranteed minimum distance between vertices in the output. This is generally some fraction of "snap_radius".
The guaranteed minimum spacing between edges and non-incident vertices in the output. This is generally some fraction of "snap_radius".
Returns a candidate snap site for the given point. The final vertex locations are a subset of the snap sites returned by this function (spaced at least "min_vertex_separation" apart).
A SnapFunction that snaps vertices to S2LatLng E5, E6, or E7 coordinates. These coordinates are expressed in degrees multiplied by a power of 10 and then rounded to the nearest integer. For example, in E6 coordinates the point (23.12345651, -45.65432149) would become (23123457, -45654321).
The main argument of the SnapFunction is the exponent for the power of 10 that coordinates should be multipled by before rounding. For example, IntLatLngSnapFunction(7) is a function that snaps to E7 coordinates. The exponent can range from 0 to 10.
Each exponent has a corresponding minimum snap radius, which is simply the maximum distance that a vertex can move when snapped. It is approximately equal to 1/sqrt(2) times the nominal point spacing; for example, for snapping to E7 the minimum snap radius is (1e-7 / sqrt(2)) degrees. You can also set the snap radius to any value larger than this; this can result in significant extra simplification (similar to using a larger exponent) but does not move vertices unnecessarily.