MathUtils class

Utility functions used by both PolyUtils and SphericalUtils.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

arcHav(double x) double
Computes the inverse haversine. Numerically stable around 0.
clamp(double x, double low, double high) double
Restricts x to the range [low, high].
hav(double x) double
Returns haversine of x (angle in radians).
havDistance(double lat1, double lat2, double dLng) double
Returns hav() of distance from (lat1, lng1) to (lat2, lng2) on the unit sphere, where dLng = lng1 − lng2.
havFromSin(double x) double
Returns hav(asin(x)).
inverseMercator(double y) double
Returns the latitude (in radians) from the Mercator Y coordinate y.
mercator(double lat) double
Returns the Mercator Y coordinate corresponding to lat (in radians).
mod(double x, double m) double
Returns the non-negative remainder of x / m.
sinFromHav(double h) double
Given h == hav(x), returns sin(|x|).
sinSumFromHav(double x, double y) double
Returns sin(arcHav(x) + arcHav(y)).
wrap(double n, double min, double max) double
Wraps n into the inclusive-exclusive interval [min, max).

Constants

earthRadius → const double
The earth's mean radius in meters (IUGG).