List of usage examples for java.lang Math sqrt
@HotSpotIntrinsicCandidate public static double sqrt(double a)
From source file:Main.java
public static double distanceBetweenPoints(double x1, double y1, double x2, double y2) { return Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2)); }
From source file:Main.java
public static float distance(float x1, float y1, float x2, float y2) { return (float) Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }
From source file:Main.java
public static float distance(float x1, float y1, float x2, float y2) { float x = x2 - x1; float y = y2 - y1; return (float) Math.sqrt(x * x + y * y); }
From source file:Main.java
public static float distance(float x1, float y1, float x2, float y2) { float dx = x1 - x2; float dy = y1 - y2; return (float) Math.sqrt(dx * dx + dy * dy); }
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
public static double GY(int x, int y, Bitmap bitmap) { double res = 1 * getPixel(x - 1, y - 1, bitmap) + Math.sqrt(2) * getPixel(x, y - 1, bitmap) + 1 * getPixel(x + 1, y - 1, bitmap) + (-1) * getPixel(x - 1, y + 1, bitmap) + (-Math.sqrt(2)) * getPixel(x, y + 1, bitmap) + (-1) * getPixel(x + 1, y + 1, bitmap); return res;/*from w ww . ja v a 2s.c om*/ }
From source file:Main.java
public static float length(float[] values) { return (float) Math.sqrt(dot(values, values)); }
From source file:Main.java
public static double[] Rec2Sph(double x, double y, double z) { double[] sph = new double[3]; sph[0] = Math.sqrt(x * x + y * y + z * z); sph[1] = x == 0 ? 0 : Math.atan(Math.abs(y / x)); if (x < 0) sph[1] = Math.PI - sph[1]; if (y < 0) sph[1] *= -1;// w w w .j a v a 2 s .c om sph[2] = Math.asin(z / sph[0]); return sph; }
From source file:Main.java
public static double calculateVectorMod(float value[]) { double r = 0; for (int i = 0; i < value.length; i++) r += value[i] * value[i];//from ww w . j a va 2 s .co m return Math.sqrt(r); }
From source file:Main.java
public static double[] getAbs(double[] result) { double[] abs = new double[result.length / 2]; for (int i = 0; i < result.length / 2; i++) { abs[i] = Math.sqrt(result[2 * i] * result[2 * i] + result[2 * i + 1] * result[2 * i + 1]); }/*from www. j a va2s . com*/ return abs; }