コード例 #1
0
ファイル: Position.java プロジェクト: 21moons/contiki
 /**
  * Calculates distance from this position to given position.
  *
  * @param pos Compared position
  * @return Distance
  */
 public double getDistanceTo(Position pos) {
   return Math.sqrt(
       Math.abs(coords[0] - pos.getXCoordinate()) * Math.abs(coords[0] - pos.getXCoordinate())
           + Math.abs(coords[1] - pos.getYCoordinate())
               * Math.abs(coords[1] - pos.getYCoordinate())
           + Math.abs(coords[2] - pos.getZCoordinate())
               * Math.abs(coords[2] - pos.getZCoordinate()));
 }