public class SloppyMath extends Object
| Modifier and Type | Field and Description |
|---|---|
static double |
TO_DEGREES |
static double |
TO_RADIANS |
| Constructor and Description |
|---|
SloppyMath() |
| Modifier and Type | Method and Description |
|---|---|
static double |
asin(double a)
Returns the arc sine of a value.
|
static double |
cos(double a)
Returns the trigonometric cosine of an angle.
|
static double |
haversinKilometers(double lat1,
double lon1,
double lat2,
double lon2)
Deprecated.
Use
instead |
static double |
haversinMeters(double sortKey)
Returns the Haversine distance in meters between two points
given the previous result from
haversinSortKey(double, double, double, double) |
static double |
haversinMeters(double lat1,
double lon1,
double lat2,
double lon2)
Returns the Haversine distance in meters between two points
specified in decimal degrees (latitude/longitude).
|
static double |
haversinSortKey(double lat1,
double lon1,
double lat2,
double lon2)
Returns a sort key for distance.
|
public static final double TO_RADIANS
public static final double TO_DEGREES
public static double haversinMeters(double lat1,
double lon1,
double lat2,
double lon2)
Error is around 1E-5 (0.01mm) from the actual haversine distance.
lat1 - Latitude of the first point.lon1 - Longitude of the first point.lat2 - Latitude of the second point.lon2 - Longitude of the second point.public static double haversinMeters(double sortKey)
haversinSortKey(double, double, double, double)@Deprecated public static double haversinKilometers(double lat1, double lon1, double lat2, double lon2)
insteadlat1 - Latitude of the first point.lon1 - Longitude of the first point.lat2 - Latitude of the second point.lon2 - Longitude of the second point.public static double haversinSortKey(double lat1,
double lon1,
double lat2,
double lon2)
haversinMeters(double, double, double, double), but it always compares the same.
This can be converted into an actual distance with haversinMeters(double), which
effectively does the second half of the computation.public static double cos(double a)
Error is around 1E-15.
Special cases:
NaN or an infinity, then the result is NaN.
a - an angle, in radians.Math.cos(double)public static double asin(double a)
The returned angle is in the range -pi/2 through pi/2. Error is around 1E-7.
Special cases:
NaN or its absolute value is greater than 1, then the result is NaN.
a - the value whose arc sine is to be returned.Math.asin(double)Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.