List of usage examples for java.lang Math abs
@HotSpotIntrinsicCandidate public static double abs(double a)
From source file:Main.java
static int calcManhattanDistance(int x0, int y0, int x1, int y1) { final int md = Math.abs(x1 - x0) + Math.abs(y1 - y0); return md;//from w ww . j a va 2 s.c om }
From source file:WtComp.java
public static boolean equals(double v1, // First argument double v2, // Second argument double e) // Epsilon { return Math.abs(v1 - v2) < e; }
From source file:Main.java
public static float manhattanDistance(float x1, float y1, float x2, float y2) { return Math.abs(x1 - x2) + Math.abs(y1 - y2); }
From source file:Main.java
private static double trapezoidArea(double x1, double y1, double x2, double y2) { return Math.abs(x2 - x1) * ((y2 + y1) / 2); }
From source file:Main.java
public static boolean isGpsValid(final double longitude, final double latitude) { return Math.abs(latitude) > 0.001 && Math.abs(longitude) > 0.001; }
From source file:Main.java
public static float getDistance(float x1, float y1, float x2, float y2) { float dx = Math.abs(x1 - x2); float dy = Math.abs(y1 - y2); return (float) Math.hypot(dx, dy); }
From source file:Main.java
public static double getUnsignedBearingDifference(double a1, double a2) { a1 = Math.abs(a1); a2 = Math.abs(a2);//from www . j a v a 2s. c o m if (a1 > 180) a1 -= 180; if (a2 > 180) a2 -= 180; return Math.abs(getBearingDifference(a1, a2)); }
From source file:Main.java
public static double distance(double x1, double y1, double x2, double y2) { return Math.sqrt(Math.abs(x1 - x2) * Math.abs(x1 - x2) + Math.abs(y1 - y2) * Math.abs(y1 - y2)); }
From source file:Main.java
public static String randNum(long dig, long len) { String number;//w w w . j ava 2 s.c o m int num = (int) Math.abs((Math.round(Math.random() * dig) + len)); number = Integer.toString(num); return number; }
From source file:Main.java
public static boolean isEqualLarge(int currentX, int currentY, int lastX, int lastY) { if (Math.abs(currentX - lastX) < 100 && Math.abs(currentY - lastY) < 100) { return true; }//from w ww .ja v a 2 s. co m return false; }