@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;
}

@ 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 ; }
moves a point to the closest grid point in a direction .
