List of utility methods to do Distance Calculate
float | calculateDistanceNoNormalization(float[] vec1, float[] vec2) Calculates distance between 2 vectors without normalizing float distance = 0; for (int i = 0; i < vec1.length; i++) { distance += vec1[i] * vec2[i]; return distance; |
double | calculateDistancePointToShowerAxis(double cogx, double cogy, double delta, double x, double y) calculate Distance Point To Shower Axis double distance = 0; double r0 = (x - cogx) * Math.cos(delta) + (y - cogy) * Math.sin(delta); distance = Math .sqrt(Math.pow(cogx - x + r0 * Math.cos(delta), 2) + Math.pow(cogy - y + r0 * Math.sin(delta), 2)); return distance; |
double | calculateDistanceWithWGS84(double lat1, double lng1, double lat2, double lng2) calculate Distance With WGS return calculateDistance(toDegree(lat1), toDegree(lng1), toDegree(lat2), toDegree(lng2));
|
double | computeDistance(double lat1, double lon1, double lat2, double lon2) compute Distance int MAXITERS = 20; lat1 *= Math.PI / 180.0; lat2 *= Math.PI / 180.0; lon1 *= Math.PI / 180.0; lon2 *= Math.PI / 180.0; double a = 6378137.0; double b = 6356752.3142; double f = (a - b) / a; ... |
Double | computeDistance(Double startLat, Double startLon, Double endLat, Double endLon) computes the distance between 2 points Double distance = null; double p1 = Math.cos(startLat) * Math.cos(startLon) * Math.cos(endLat) * Math.cos(endLat); double p2 = Math.cos(startLat) * Math.sin(startLon) * Math.cos(endLat) * Math.sin(endLon); double p3 = Math.sin(startLat) * Math.sin(endLat); distance = (Math.acos(p1 + p2 + p3) * EARTH_RADIUS); distance = distance * 1000; return distance; |
float | computeDistance(final int[] position1, final int[] position2) compute Distance float dist = 0; for (int d = 0; d < position1.length; ++d) { final int pos = position2[d] - position1[d]; dist += pos * pos; return (float) Math.sqrt(dist); |
double | computeDistance(int p1x, int p1y, int p2x, int p2y) Calcula la distancia euclidea de dos puntos, dado sus coordenadas. int cat1 = Math.abs(p1x - p2x); int cat2 = Math.abs(p1y - p2y); double dis = Math.sqrt((Math.pow(cat1, 2) + Math.pow(cat2, 2))); return dis; |
long | computeDistance(long[] a, long[] b) compute Distance long dist = 0; for (int i = 0; i < a.length; i++) { dist += (a[i] - b[i]) * (a[i] - b[i]); return (long) Math.sqrt(dist) + 1; |
void | computeDistanceAndBearingFast(double lat1, double lon1, double lat2, double lon2, float[] results) Fast calculation with Cos/Sin/Atan over LockUpTable double longitude1 = lon1; double longitude2 = lon2; double latitude1 = Math.toRadians(lat1); double latitude2 = Math.toRadians(lat2); lat1 *= DEG_RAD; lon1 *= DEG_RAD; lat2 *= DEG_RAD; lon2 *= DEG_RAD; ... |
long | computeDistanceImpl(final String firstStringInAlgorithm, final String secondStringInAlgorithm) Algorithm: (terms: s = firstString. int firstStringLength = firstStringInAlgorithm.length(); int secondStringLength = secondStringInAlgorithm.length(); long matrix[][]; if (firstStringLength == 0) { return secondStringLength; if (secondStringLength == 0) { return firstStringLength; ... |