public double distance(double p1,double p2){
  double d=(p1 - p2) * (p1 - p2);
  return Math.sqrt(d);
}

public double distance ( double p1 , double p2 ) { double d = ( p1 - p2 ) * ( p1 - p2 ) ; return Math . sqrt ( d ) ; }
calculates the euclidean distance between two points .
