List of usage examples for java.lang Math sin
@HotSpotIntrinsicCandidate public static double sin(double a)
From source file:Main.java
public static int latitudeToPixelY(double latitude, double zoomLevel, int tileSize) { double sinLatitude = Math.sin(latitude * (Math.PI / 180)); int mapSize = getMapSize(zoomLevel, tileSize); return (int) Math .round((0.5d - Math.log((1d + sinLatitude) / (1d - sinLatitude)) / (4d * Math.PI)) * mapSize); }
From source file:Main.java
public static float[] rotate2d(float x0, float y0, float th) { float cos = (float) Math.cos(th); float sin = (float) Math.sin(th); float x = x0 * cos - y0 * sin;//x' = x*cos b - y*sin b float y = x0 * sin + y0 * cos;//y' = x*sin b + y*cos b return new float[] { x, y }; }
From source file:Main.java
public static double GetDistance(double pLatitude1, double pLongitude1, double pLatitude2, double pLongitude2) { double vDist = Math.sin(deg2rad(pLatitude1)) * Math.sin(deg2rad(pLatitude2)) + Math.cos(deg2rad(pLatitude1)) * Math.cos(deg2rad(pLatitude2)) * Math.cos(deg2rad(pLongitude1 - pLongitude2)); vDist = Math.acos(vDist);/* ww w. ja va 2 s . com*/ vDist = rad2deg(vDist); vDist = vDist * 111189.57696;// * 60 * 1.1515 * 1.609344 * 1000; return vDist; }
From source file:Main.java
public static Point getDirectionPoint(double bearing, Point posFrom, int length) { int x = (int) (Math.sin(bearing) * length); int y = (int) (Math.cos(bearing) * length); return new Point(posFrom.x + x, posFrom.y + y); }
From source file:Main.java
public static double distance(double lat1, double lon1, double lat2, double lon2) { Double theta = lon1 - lon2;//from ww w .j a va 2 s. com Double dist = (Math.sin(deg2rad(lat1)) * Math.sin(deg2rad(lat2))) + (Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.cos(deg2rad(theta))); dist = Math.acos(dist); dist = rad2deg(dist); dist = dist * 60 * 1.1515; // M // dist = dist * 1.609344 * 1000; // m dist = dist * 1.609344; // km // dist = dist * 0.8684; //n return dist; }
From source file:Main.java
public static double[] geoToMercator(double[] g) { double d = g[0] * Math.PI / 180, m = g[1] * Math.PI / 180, l = 6378137, k = 0.0818191908426, f = k * Math.sin(m); double h = Math.tan(Math.PI / 4 + m / 2), j = Math.pow(Math.tan(Math.PI / 4 + Math.asin(f) / 2), k), i = h / j;/*from ww w.j a va2s . c o m*/ // return new DoublePoint(Math.round(l * d), Math.round(l * // Math.log(i))); return new double[] { l * d, l * Math.log(i) }; }
From source file:Main.java
/** * Same as toX, but converts to Y component, assuming positive Y is down. * /*from w ww .j av a 2s . c o m*/ * @param angle * @return */ public static double toY(int angle) { return Math.sin(Math.toRadians(angle - 90)); }
From source file:Main.java
/** * Calculate sin^2(x)./* w ww . j a v a 2s.com*/ * * @param x * x * @return sin^2(x) * @since 1.0 */ protected static double sinSquared(double x) { return Math.sin(x) * Math.sin(x); }
From source file:Main.java
public static double earth_Rn(double L) { return earth_R * (1 - 2 * M_E + 3 * M_E * Math.sin(L)); }
From source file:Main.java
public static double smallestAngularDifferenceDegrees(double firstAngleDeg, double secondAngleDeg) { double d = ((firstAngleDeg - secondAngleDeg) * 3.141592653589793d) / 180.0d; return (Math.atan2(Math.sin(d), Math.cos(d)) * 180.0d) / 3.141592653589793d; }