public double getK(Point p1, Point p2) {
        int x1 = p1.x, y1 = p1.y;
        int x2 = p2.x, y2 = p2.y;
        double res = (y2 - y1) / (double) (x2 - x1);
        // http://stackoverflow.com/questions/14771328/java-signed-zero-and-boxing
        if (res == -0.0)
            return 0.0;
        else
            return res;
    }