/**
   * The top level rendering call. This function calls beforeResampleAll, resampleAll, and
   * mapIntermediateToFinal, all virtual functions that are implemented in derived classes.
   *
   * @param iDS The number of slices to increment during the resampling phase. The value should be
   *     one or larger. If one, all slices of the volume data are resampled. If two, only every
   *     other slice is resampled. An input larger than one is used to allow fast rendering during
   *     rotation of the volume data. Once the rotation terminates, a composite with input of one
   *     should be called.
   */
  public synchronized void composite(int iDS) {
    long startTime = 0, now = 0;
    double elapsedTime = 0d;

    // compute maximum component of the box direction vector
    float fMax = 0.0f;
    int i, iMax = -1;

    for (i = 0; i < 3; i++) {
      float fAbs = Math.abs(m_aafBox[2][i]);

      if (fAbs > fMax) {
        fMax = fAbs;
        iMax = i;
      }
    }

    startTime = System.currentTimeMillis();
    traceInit();

    // composite in the appropriate direction
    if (iMax == 0) {
      beforeResampleAll(1, 2, 0);
    } else if (iMax == 1) {
      beforeResampleAll(2, 0, 1);
    } else {
      beforeResampleAll(0, 1, 2);
    }

    resampleAll(iDS);
    mapIntermediateToFinal();
    now = System.currentTimeMillis();
    elapsedTime = (double) (now - startTime);

    if (elapsedTime <= 0) {
      elapsedTime = (double) 0.0;
    }

    Preferences.debug(
        "Shear elapse time = " + (double) (elapsedTime / 1000.0) + "\n"); // in seconds
  }
  // Override Behavior's initialize method to setup wakeup criteria
  public void initialize() {
    alpha.setStartTime(System.currentTimeMillis());

    // Establish initial wakeup criteria
    wakeupOn(w);
  }