MathUtil class
Properties
hashCode
→ int
The hash code for this object.
no setter inherited
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
Methods
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString ()
→ String
A string representation of this object.
inherited
Static Methods
arcHav (num x )
→ num
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.
clamp (num x , num low , num high )
→ num
Restrict x to the range low, high
.
hav (num x )
→ num
Returns haversine(angle-in-radians).
hav(x) == (1 - cos(x)) / 2 == sin(x / 2)^2.
havDistance (num lat1 , num lat2 , num dLng )
→ num
Returns hav() of distance from (lat1, lng1) to (lat2, lng2) on the unit
sphere.
havFromSin (num x )
→ num
inverseMercator (num y )
→ num
Returns latitude from mercator Y.
mercator (num lat )
→ num
Returns mercator Y corresponding to latitude.
See http://en.wikipedia.org/wiki/Mercator_projection .
mod (num x , num m )
→ num
Returns the non-negative remainder of x / m.
@param x The operand.
@param m The modulus.
sinFromHav (num h )
→ num
sinSumFromHav (num x , num y )
→ num
toDegrees (num rad )
→ num
toRadians (num degrees )
→ num
wrap (num n , num min , num max )
→ num
Wraps the given value into the inclusive-exclusive interval between min
and max.
@param n The value to wrap.
@param min The minimum.
@param max The maximum.