Java Distance Calculate distance(int x1, int y1, int x2, int y2)

Here you can find the source of distance(int x1, int y1, int x2, int y2)

Description

distance

License

LGPL

Declaration

static int distance(int x1, int y1, int x2, int y2) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    static int distance(int x1, int y1, int x2, int y2) {
        int x = x1 - x2;
        int y = y1 - y2;
        double d = Math.sqrt(x * x + y * y);
        return (int) Math.round(d);
    }/*from  w w  w . jav  a2  s  . com*/
}

Related

  1. distance(int one, int two)
  2. distance(int px, int py, int x1, int y1, int x2, int y2)
  3. distance(int q1, int r1, int q2, int r2)
  4. distance(int x, int y, int targetX, int targetY, int minDist, int[] outCoords)
  5. Distance(int X1, int X2, int Y1, int Y2)
  6. distance(int x1, int y1, int x2, int y2)
  7. distance(int x1, int y1, int x2, int y2)
  8. distance(int xa, int ya, int xb, int yb)
  9. distance(int[] a, int[] b)