question: @ Override public Point2D . Double translatePoint ( Point2D . Double p , TranslationDirection dir ) { Point2D . Double p0 = constrainPoint ( ( Point2D . Double ) p . clone ( ) ) ; switch ( dir ) { case NORTH : case NORTH_WEST : case NORTH_EAST : p . y = p0 . y - height ; break ; case SOUTH : case SOUTH_WEST : case SOUTH_EAST : p . y = p0 . y + height ; break ; } switch ( dir ) { case WEST : case NORTH_WEST : case SOUTH_WEST : p . x = p0 . x - width ; break ; case EAST : case NORTH_EAST : case SOUTH_EAST : p . x = p0 . x + width ; break ; } return p ; }
target:  Moves a point to the closest grid point in a direction.