private double distanceD2(double[] f,double d1){
  return Math.sqrt(Math.pow(normVector(f),2) - Math.pow(d1,2));
}

private double distanceD2 ( double [ ] f , double d1 ) { return Math . sqrt ( Math . pow ( normVector ( f ) , 2 ) - Math . pow ( d1 , 2 ) ) ; }
computes the perpendicular distance to the reference direction .
