Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/backend/utils.java
Show All 23 Lines | public static Double measuredistanceBetween(double lat1,double long1,double lat2,double long2){ | ||||
final double a = Math.sin(deltaPhi/2)*Math.sin(deltaPhi/2)+ | final double a = Math.sin(deltaPhi/2)*Math.sin(deltaPhi/2)+ | ||||
Math.cos(phi1)*Math.cos(phi2)*Math.sin(deltaTheta/2)*Math.sin(deltaTheta/2); | Math.cos(phi1)*Math.cos(phi2)*Math.sin(deltaTheta/2)*Math.sin(deltaTheta/2); | ||||
final double c = 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)); | final double c = 2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)); | ||||
return Math.abs(EarthRadius*c); | return Math.abs(EarthRadius*c); | ||||
} | } | ||||
public static Double angleRawDifferenceFromMeters(double distanceInMeters){ | |||||
return Math.toDegrees(distanceInMeters/EarthRadius); | |||||
} | |||||
/* | /* | ||||
public static int convertDipToPixels(Context con,float dips) | public static int convertDipToPixels(Context con,float dips) | ||||
{ | { | ||||
return (int) (dips * con.getResources().getDisplayMetrics().density + 0.5f); | return (int) (dips * con.getResources().getDisplayMetrics().density + 0.5f); | ||||
} | } | ||||
*/ | */ | ||||
public static float convertDipToPixels(Context con, float dp){ | public static float convertDipToPixels(Context con, float dp){ | ||||
▲ Show 20 Lines • Show All 114 Lines • Show Last 20 Lines |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register