Here you can find the source of calcDistance(int ax, int ay, int bx, int by)
Parameter | Description |
---|---|
ax | a parameter |
ay | a parameter |
bx | a parameter |
by | a parameter |
public static int calcDistance(int ax, int ay, int bx, int by)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w ww.ja v a2 s.c o m*/ * @param ax * @param ay * @param bx * @param by * @return */ public static int calcDistance(int ax, int ay, int bx, int by) { int sum1 = bx - ax; int sum2 = by - ay; double square = (Math.pow(sum1, 2) + Math.pow(sum2, 2)); int distance = (int) Math.sqrt(square); return distance; } }