public double distance(IMultiPoint imp){
  if (imp.dimensionality() != dimensionality) {
    throw new IllegalArgumentException("distance computation can only be performed between points with the same dimension.");
  }
  double sum=0;
  if (imp instanceof Hyperpoint) {
    Hyperpoint other=(Hyperpoint)imp;
    for (int i=1; i <= dimensionality; i++) {
      double d=other.values[i - 1] - values[i - 1];
      sum+=d * d;
    }
  }
 else {
    for (int i=1; i <= dimensionality; i++) {
      double v=imp.getCoordinate(i);
      sum+=(v - values[i - 1]) * (v - values[i - 1]);
    }
  }
  return Math.sqrt(sum);
}

public double distance ( IMultiPoint imp ) { if ( imp . dimensionality ( ) != dimensionality ) { throw new IllegalArgumentException ( "distance computation can only be performed between points with the same dimension." ) ; } double sum = 0 ; if ( imp instanceof Hyperpoint ) { Hyperpoint other = ( Hyperpoint ) imp ; for ( int i = 1 ; i <= dimensionality ; i ++ ) { double d = other . values [ i - 1 ] - values [ i - 1 ] ; sum += d * d ; } } else { for ( int i = 1 ; i <= dimensionality ; i ++ ) { double v = imp . getCoordinate ( i ) ; sum += ( v - values [ i - 1 ] ) * ( v - values [ i - 1 ] ) ; } } return Math . sqrt ( sum ) ; }
return the euclidean distance between the given imultipoint . < p > optimized for two hyperpoint objects , but works with any imultipoint
