List of usage examples for java.lang Math pow
@HotSpotIntrinsicCandidate public static double pow(double a, double b)
From source file:Main.java
public static double getMaxInteger(float digit) { String intStr = ((int) digit + ""); Integer intLength = intStr.length(); return Math.pow(10, intLength); }
From source file:Main.java
private static float getCurvature(final float dxt, final float dyt, final float ddxt, final float ddyt) { return Math.abs(dxt * ddyt - dyt * ddxt) / (float) Math.pow(dxt * dxt + dyt * dyt, 3f / 2f); }
From source file:Main.java
public static double round(double value, int places) { if (places < 0) throw new IllegalArgumentException(); long factor = (long) Math.pow(10, places); value = value * factor;//from www . j a v a2s . c om long tmp = Math.round(value); return (double) tmp / factor; }
From source file:Main.java
public static float truncate(float f, int decimalPlaces) { float decimalShift = (float) Math.pow(10, decimalPlaces); return Math.round(f * decimalShift) / decimalShift; }
From source file:Main.java
static float getQuadTargetPoint(float startPoint, float endPoint, float bezierPoint, float t) { return (float) (bezierPoint - (Math.pow(1.f - t, 2.f) * startPoint + Math.pow(t, 2.f) * endPoint)) / (2.f * t * (1.f - t));/*from w w w.j ava 2 s . c o m*/ }
From source file:Main.java
public static double distance(double currentLatitude, double currentLongitude, double compareLatitude, double compareLongitude) { return Math.sqrt( Math.pow(currentLatitude - compareLatitude, 2) + Math.pow(currentLongitude - compareLongitude, 2)); }
From source file:Main.java
private static Double calculateMagnitude(Map<Object, Integer> map1) { Double sum = 0.0;//from w w w. j a v a 2s . com for (Integer value : map1.values()) { sum += Math.pow(value, 2); } return Math.sqrt(sum); }
From source file:Main.java
public static double pointDistance(Point a, Point b) { return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2)); }
From source file:Main.java
public static double getLong(int inX, int zoom) { double x = Math.floor(inX * 256); double longitude = ((x * 360) / (256 * Math.pow(2, zoom))) - 180; while (longitude > 180.0) { longitude -= 360.0;/*from w w w . j a va 2 s.c om*/ } while (longitude < -180.0) { longitude += 360.0; } return longitude; }
From source file:Main.java
private static double calcEuclideanDist(double aLat, double aLong, double bLat, double bLong) { // return Math.sqrt(Math.pow(aLat-bLat,2) + Math.pow(aLong-bLong, 2)); return (Math.pow(aLat - bLat, 2) + Math.pow(aLong - bLong, 2)); }