graphdb/src/main/java/com/orientechnologies/orient/graph/sql/functions/OSQLFunctionHeuristicPathFinderAbstract.java
protected double getDiagonalHeuristicCost(double x, double y, double gx, double gy, double dFactor) {
        double dx = Math.abs(x - gx);
        double dy = Math.abs(y - gy);
        double h_diagonal = Math.min(dx, dy);
        double h_straight = dx + dy;
        return (dFactor * 2) * h_diagonal + dFactor * (h_straight - 2 * h_diagonal);
    }
protected double getDiagonalHeuristicCost(double x, double y, double gx, double gy, double dFactor) {
        double dx = Math.abs(x - gx);
        double dy = Math.abs(y - gy);
        double h_diagonal = Math.min(dx, dy);
        double h_straight = dx + dy;
        return (dFactor * 2) * h_diagonal + dFactor * (h_straight - 2 * h_diagonal);
    }
obtains from http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html