question: 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 ; }
target:  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).