MathUtils class

Utility functions that are 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 Properties

earthRadius double
The earth's radius, in meters. Mean radius as defined by IUGG.
final

Static Methods

arcHav(double x) double
Computes inverse haversine. Has good numerical stability around 0.
clamp(double x, double low, double high) double
Restrict x to the range from low to high.
hav(double x) double
Returns haversine(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.
havFromSin(double x) double
Returns hav(asin(x)).
inverseMercator(double y) double
Returns latitude from mercator Y.
mercator(double lat) double
Returns mercator Y corresponding to latitude.
mod(double x, double m) double
Returns the non-negative remainder of x / m.
sinFromHav(double h) double
Given h==hav(x), returns sin(abs(x)).
sinSumFromHav(double x, double y) double
Returns sin(arcHav(x) + arcHav(y)).
wrap(double n, double min, double max) double
Wraps the given value into the inclusive-exclusive interval between min and max. n The value to wrap.