code: private static int pos4twist(double rank,
                                   double phase,
                                   double period,
                                   int hOrW,
                                   int xOrY,
                                   int yOrX) {
          double dyOrX = Math.PI * rank * yOrX / hOrW + phase;
          double dxOrY = Math.sin(dyOrX);
          return xOrY + (int) (dxOrY * period);
      }
docs: 2. width, y, x