Exemplo n.º 1
0
 // create SimpleBehavior
 public TimestepBehavior(
     Histogram3D histogram, int maxProton, int maxNeutron, ColorRamping colorRamp) {
   targetHistogram = histogram;
   this.targetTG = targetHistogram.tg;
   targetColorRamp = colorRamp;
   targetMaxNeutron = maxNeutron;
   targetMaxProton = maxProton;
   histColor = new Color3f();
   posVector.set(
       (float) targetHistogram.neutronNumber - ((float) maxNeutron / 2.0f),
       (float) targetHistogram.abundance[0] - targetHistogram.normalizationFactor,
       (float) -targetHistogram.protonNumber + ((float) maxProton / 2.0f));
 }
Exemplo n.º 2
0
  public void processStimulus(Enumeration criteria) {
    posVector.set(
        (float) targetHistogram.neutronNumber - ((float) targetMaxNeutron / 2.0f),
        (float) targetHistogram.abundance[step] - targetHistogram.normalizationFactor,
        (float) -targetHistogram.protonNumber + ((float) targetMaxProton / 2.0f));
    ca = targetHistogram.fillingAppearance.getColoringAttributes();
    targetColorRamp.getColor(
        targetHistogram.abundance[step] - targetHistogram.normalizationFactor, histColor);
    ca.setColor(histColor);

    step++;
    if (step >= targetHistogram.abundance.length) {
      step = 0;
    }

    targetT3D.set(posVector);
    targetTG.setTransform(targetT3D);
    this.wakeupOn(new WakeupOnAWTEvent(MouseEvent.MOUSE_CLICKED));
  }