List of usage examples for org.apache.lucene.util SloppyMath TO_RADIANS
double TO_RADIANS
To view the source code for org.apache.lucene.util SloppyMath TO_RADIANS.
Click Source Link
From source file:org.codelibs.elasticsearch.common.geo.GeoUtils.java
License:Apache License
/** * Return the distance (in meters) between 2 lat,lon geo points using a simple tangential plane * this provides a faster alternative to {GeoUtils#arcDistance} when points are within 5 km *//*from w w w . jav a 2 s .com*/ public static double planeDistance(double lat1, double lon1, double lat2, double lon2) { double x = (lon2 - lon1) * SloppyMath.TO_RADIANS * Math.cos((lat2 + lat1) / 2.0 * SloppyMath.TO_RADIANS); double y = (lat2 - lat1) * SloppyMath.TO_RADIANS; return Math.sqrt(x * x + y * y) * EARTH_MEAN_RADIUS; }