public static double[] vectorBoxCorner(double[] center,double[] result,double distance,boolean upperRight){
  if (result == null || result.length != center.length) {
    result=new double[center.length];
  }
  if (upperRight == false) {
    distance=-distance;
  }
  distance=SIN_PI_DIV_4 * distance;
  for (int i=0; i < center.length; i++) {
    result[i]=center[i] + distance;
  }
  return result;
}

public static double [ ] vectorBoxCorner ( double [ ] center , double [ ] result , double distance , boolean upperRight ) { if ( result == null || result . length != center . length ) { result = new double [ center . length ] ; } if ( upperRight == false ) { distance = - distance ; } distance = SIN_PI_DIV_4 * distance ; for ( int i = 0 ; i < center . length ; i ++ ) { result [ i ] = center [ i ] + distance ; } return result ; }
return the coordinates of a vector that is the corner of a box ( upper right or lower left ) , assuming a rectangular coordinate system . note , this does not apply for points on a sphere or ellipse ( although it could be used as an approximation ) .
