Example usage for java.lang Math sqrt

List of usage examples for java.lang Math sqrt

Introduction

In this page you can find the example usage for java.lang Math sqrt.

Prototype

@HotSpotIntrinsicCandidate
public static double sqrt(double a) 

Source Link

Document

Returns the correctly rounded positive square root of a double value.

Usage

From source file:Main.java

public static float mould(float[] vec) {
    return (float) Math.sqrt(vec[0] * vec[0] + vec[1] * vec[1]);
}

From source file:Main.java

public static float hypo(float a, float b) {
    return (float) Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
}

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 boolean isLight(int color) {
    return Math.sqrt(Color.red(color) * Color.red(color) * .241 + Color.green(color) * Color.green(color) * .691
            + Color.blue(color) * Color.blue(color) * .068) > 130;
}

From source file:Main.java

public static double get_distance(double x1, double y1, double x2, double y2) {
    return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}

From source file:Main.java

private static float distance(double x1, double y1, double x2, double y2) {
    return (float) Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
}

From source file:Main.java

public static boolean checkInRound(float sx, float sy, float r, float x, float y) {
    return Math.sqrt((sx - x) * (sx - x) + (sy - y) * (sy - y)) < r;
}

From source file:Main.java

public static float getPoint2PointDistance(float x1, float y1, float x2, float y2) {
    return (float) Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2));
}

From source file:Main.java

public static float getDistanceBetweenTwoPoints(float x1, float y1, float x2, float y2) {
    return (float) Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}

From source file:Main.java

public static int getDistance(float _firstX, float _firstY, float _secondX, float _secondY) {
    return (int) Math.sqrt(Math.pow(_firstX - _secondX, 2) + Math.pow(_firstY - _secondY, 2));
}