public static void translate(double dx,double dy,Coordinate[] coords){
  int last=coords.length - 1;
  for (int i=0; i < last; i++) {
    coords[i].x+=dx;
    coords[i].y+=dy;
  }
  if (coords[0] != coords[last]) {
    coords[last].x+=dx;
    coords[last].y+=dy;
  }
}

public static void translate ( double dx , double dy , Coordinate [ ] coords ) { int last = coords . length - 1 ; for ( int i = 0 ; i < last ; i ++ ) { coords [ i ] . x += dx ; coords [ i ] . y += dy ; } if ( coords [ 0 ] != coords [ last ] ) { coords [ last ] . x += dx ; coords [ last ] . y += dy ; } }
translates all coordinates in the array by dx , dy
