Utility functions that are used my both PolyUtil and SphericalUtil.
The earth's radius, in meters. Mean radius as defined by IUGG.
Computes inverse haversine. Has good numerical stability around 0. arcHav(x) == acos(1 - 2 * x) == 2 * asin(sqrt(x)). The argument must be in 0, 1, and the result is positive.
Restrict x to the range low, high.
Returns haversine(angle-in-radians). hav(x) == (1 - cos(x)) / 2 == sin(x / 2)^2.
Returns hav() of distance from (lat1, lng1) to (lat2, lng2) on the unit sphere.
Returns latitude from mercator Y.
Returns mercator Y corresponding to latitude. See http://en.wikipedia.org/wiki/Mercator_projection .
Returns the non-negative remainder of x / m.
Wraps the given value into the inclusive-exclusive interval between min and max.