/**
  * Draws the spokes for the polar plot.
  *
  * @param panel
  * @param g
  */
 public void drawSpokes(double rmax, DrawingPanel panel, Graphics g) {
   g.setColor(gridcolor);
   for (double theta = 0; theta < Math.PI; theta += dtheta) {
     int x1 = panel.xToPix(rmax * Math.cos(theta));
     int y1 = panel.yToPix(rmax * Math.sin(theta));
     int x2 = panel.xToPix(-rmax * Math.cos(theta));
     int y2 = panel.yToPix(-rmax * Math.sin(theta));
     g.drawLine(x1, y1, x2, y2);
   }
 }
 /**
  * Draws the spokes for the polar plot.
  *
  * @param panel
  * @param g
  */
 protected void drawRAxis(double dr, double rmax, DrawingPanel panel, Graphics g) {
   Graphics2D g2 = (Graphics2D) g;
   g.setColor(gridcolor.darker());
   int x1 = panel.xToPix(0);
   int y1 = panel.yToPix(0);
   int x2 = panel.xToPix(rmax);
   g.drawLine(x1, y1, Math.min(x2, panel.getWidth() - panel.getRightGutter()), y1);
   FontMetrics fm = g2.getFontMetrics();
   int nLabels = (int) (panel.getXMax() / dr / MAJOR_TIC);
   int stride = (nLabels > 3) ? 2 : 1;
   double rm = Math.min(rmax, panel.getXMax());
   for (double r = (nLabels > 3) ? stride * MAJOR_TIC * dr : MAJOR_TIC * dr;
       r <= rm;
       r += (stride * MAJOR_TIC * dr)) {
     String label = getLabel(r);
     int sW = fm.stringWidth(label) + 4;
     int sH = fm.getHeight();
     g2.setColor(new Color(247, 247, 247));
     int x0 = panel.xToPix(r), y0 = panel.yToPix(0);
     g2.fill(new Rectangle2D.Double(x0 - sW / 2, y0 + 3, sW, sH));
     g2.setColor(Color.black);
     g2.draw(new Rectangle2D.Double(x0 - sW / 2, y0 + 3, sW, sH));
     g2.setColor(Color.BLACK);
     g2.drawString(label, x0 - sW / 2 + 2, y0 + 1 + sH);
   }
 }
Esempio n. 3
0
 /**
  * Draws the image and the grid.
  *
  * @param panel
  * @param g
  */
 public void draw(DrawingPanel panel, Graphics g) {
   if (scaleFactor < 1) {
     g.drawImage(
         image.getScaledInstance(
             (int) (scaleFactor * image.getWidth()),
             (int) (scaleFactor * image.getHeight()),
             java.awt.Image.SCALE_REPLICATE),
         panel.getLeftGutter(),
         panel.getTopGutter(),
         panel);
   } else {
     // g.drawImage(image, 1+panel.xToPix(xmin), 1+panel.yToPix(ymax), panel);
     g.drawImage(image, panel.getLeftGutter(), panel.getTopGutter(), panel);
   }
 }
Esempio n. 4
0
 /**
  * Constructs a DataRaster object that maps (x,y) data to image pixels.
  *
  * @param dp the drawing panel that will be used to calculate the image size
  * @param _xmin the mininum x value that can be mapped
  * @param _xmax the maximum x value that can be mapped
  * @param _ymin the mininum y value that can be mapped
  * @param _ymax the maximum y value that can be mapped
  */
 public DataRaster(DrawingPanel dp, double _xmin, double _xmax, double _ymin, double _ymax) {
   primaryDrawingPanel = dp;
   if (primaryDrawingPanel != null) {
     primaryDrawingPanel.setPixelScale();
   }
   xmin = Math.min(_xmin, _xmax);
   xmax = Math.max(_xmin, _xmax);
   ymin = Math.min(_ymin, _ymax);
   ymax = Math.max(_ymin, _ymax);
   image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); // make a 1x1 image to start
   backgroundColor = new Color(image.getRGB(0, 0));
 }
Esempio n. 5
0
 /**
  * Gets the dimension of the lattice in pixel units.
  *
  * @param panel
  * @return the dimension
  */
 public Dimension getInterior(DrawingPanel panel) {
   float availableWidth = panel.getWidth() - panel.getLeftGutter() - panel.getRightGutter() - 1;
   float availableHeight = panel.getHeight() - panel.getTopGutter() - panel.getBottomGutter() - 1;
   scaleFactor = Math.min(availableWidth / dimension.width, availableHeight / dimension.height);
   if (scaleFactor > 1) {
     scaleFactor = 1;
     return dimension;
   }
   return new Dimension((int) (scaleFactor * ncol), (int) (scaleFactor * nrow));
 }
Esempio n. 6
0
 /** Draws clusters */
 public void draw(DrawingPanel panel, Graphics g) {
   if (site == null) {
     return;
   }
   int sizeX = Math.abs(panel.xToPix(1.0) - panel.xToPix(0));
   int sizeY = Math.abs(panel.yToPix(1.0) - panel.yToPix(0));
   for (int i = 0; i < numberOfParticles; i++) {
     int xpix = panel.xToPix(x[i]) - sizeX;
     int ypix = panel.yToPix(y[i]) - sizeY;
     g.fillRect(xpix + sizeX / 2, ypix + sizeY / 2, sizeX, sizeY);
   }
 }
    @Override
    public void paintComponent(Graphics g) {
      super.paintComponent(g);

      Graphics2D g2d = (Graphics2D) g;

      g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      g2d.setRenderingHint(
          RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
      g2d.setRenderingHint(
          RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

      for (Slot slot : Slot.values()) {
        if (slot.isShow() || slot == useSlot) {
          paintSequence(slot, slot.getPoints(), Color.BLACK, g2d);
        }
      }
    }
Esempio n. 8
0
 /**
  * Paints a new image using the existing data.
  *
  * <p>returns the image buffer
  */
 public synchronized BufferedImage render() {
   if (primaryDrawingPanel == null) {
     return null;
   }
   int xrange = primaryDrawingPanel.xToPix(xmax) - primaryDrawingPanel.xToPix(xmin);
   int yrange = primaryDrawingPanel.yToPix(ymin) - primaryDrawingPanel.yToPix(ymax);
   xrange = Math.min(xrange, primaryDrawingPanel.getWidth());
   yrange = Math.min(yrange, primaryDrawingPanel.getHeight());
   if ((Math.abs(xrange) == 0) || (Math.abs(yrange) == 0)) {
     return null; // Produces exception in IE (Paco)
   }
   image = new BufferedImage(Math.abs(xrange), Math.abs(yrange), BufferedImage.TYPE_INT_ARGB);
   backgroundColor = new Color(image.getRGB(0, 0));
   for (int i = 0, n = imageDatasets.size(); i < n; i++) {
     (imageDatasets.get(i)).render();
   }
   return image;
 }
 /**
  * Draws the rings for the polar plot.
  *
  * @param panel
  * @param g
  * @return double the ring separation used
  */
 public double drawRings(double rmax, DrawingPanel panel, Graphics g) {
   double dr = Math.max(this.dr, 1.0e-9);
   if (autospaceRings) {
     int exponent = (int) (Math.log(rmax) / LOG10);
     double decade = Math.pow(10, exponent - 1);
     dr = decade;
     while (rmax / dr > 5 * MAJOR_TIC) { // increase dr if we have more than 25 rings
       dr *= 2;
       if (dr / decade > 3.5 && dr / decade < 4.5) {
         dr = 5 * decade;
         decade *= 10;
       }
     }
   } else {
     int nrings = (int) (rmax / dr);
     while (nrings > 10 * MAJOR_TIC) {
       dr *= 2;
       nrings = (int) (rmax / dr);
     }
   }
   int xcenter = panel.xToPix(0);
   int ycenter = panel.yToPix(0);
   int xrad = (int) (panel.getXPixPerUnit() * rmax);
   int yrad = (int) (panel.getYPixPerUnit() * rmax);
   if (interiorColor != null) {
     g.setColor(interiorColor);
     g.fillOval(xcenter - xrad, ycenter - yrad, 2 * xrad, 2 * yrad);
   }
   int counter = 0;
   for (double r = 0; r <= rmax; r += dr) {
     g.setColor(gridcolor);
     xrad = panel.xToPix(r) - xcenter;
     yrad = ycenter - panel.yToPix(r);
     if (counter % MAJOR_TIC == 0) {
       g.setColor(gridcolor.darker());
     }
     g.drawOval(xcenter - xrad, ycenter - yrad, 2 * xrad, 2 * yrad);
     counter++;
   }
   return dr;
 }
Esempio n. 10
0
 /**
  * Creates contour plot of a single area division. Called by <code>draw</code> method
  *
  * @see #draw
  */
 private final void createContour(DrawingPanel panel, Graphics g) {
   double z = zmin;
   xpoints[0] = panel.xToPix(contour_vertex[0][0]) + 1;
   xpoints[2] = panel.xToPix(contour_vertex[1][0]) + 1;
   xpoints[4] = panel.xToPix(contour_vertex[2][0]) + 1;
   xpoints[6] = panel.xToPix(contour_vertex[3][0]) + 1;
   xpoints[1] = xpoints[3] = xpoints[5] = xpoints[7] = -1;
   ypoints[0] = panel.yToPix(contour_vertex[0][1]) + 1;
   ypoints[4] = panel.yToPix(contour_vertex[2][1]) + 1;
   ypoints[2] = ypoints[3] = panel.yToPix(contour_vertex[1][1]) + 1;
   ypoints[6] = ypoints[7] = panel.yToPix(contour_vertex[3][1]) + 1;
   int xmin = xpoints[0];
   int xmax = xpoints[4];
   for (int counter = 0; counter <= contour_lines + 1; counter++) {
     // Analyzes edges
     for (int edge = 0; edge < 4; edge++) {
       int index = (edge << 1) + 1;
       int nextedge = (edge + 1) & 3;
       if (z > contour_vertex[edge][2]) {
         xpoints[index - 1] = -2;
         if (z > contour_vertex[nextedge][2]) {
           xpoints[(index + 1) & 7] = -2;
           xpoints[index] = -2;
         }
       } else if (z > contour_vertex[nextedge][2]) {
         xpoints[(index + 1) & 7] = -2;
       }
       if (xpoints[index] != -2) {
         if (xpoints[index] != -1) {
           intersection[edge] += delta[edge];
           if ((index == 1) || (index == 5)) {
             ypoints[index] = panel.yToPix(intersection[edge]) + 1;
           } else {
             xpoints[index] = panel.xToPix(intersection[edge]) + 1;
           }
         } else {
           if ((z > contour_vertex[edge][2]) || (z > contour_vertex[nextedge][2])) {
             switch (index) {
               case 1:
                 delta[edge] =
                     (contour_vertex[nextedge][1] - contour_vertex[edge][1])
                         * contour_stepz
                         / (contour_vertex[nextedge][2] - contour_vertex[edge][2]);
                 intersection[edge] =
                     (contour_vertex[nextedge][1] * (z - contour_vertex[edge][2])
                             + contour_vertex[edge][1] * (contour_vertex[nextedge][2] - z))
                         / (contour_vertex[nextedge][2] - contour_vertex[edge][2]);
                 xpoints[index] = xmin;
                 ypoints[index] = panel.yToPix(intersection[edge]) + 1;
                 break;
               case 3:
                 delta[edge] =
                     (contour_vertex[nextedge][0] - contour_vertex[edge][0])
                         * contour_stepz
                         / (contour_vertex[nextedge][2] - contour_vertex[edge][2]);
                 intersection[edge] =
                     (contour_vertex[nextedge][0] * (z - contour_vertex[edge][2])
                             + contour_vertex[edge][0] * (contour_vertex[nextedge][2] - z))
                         / (contour_vertex[nextedge][2] - contour_vertex[edge][2]);
                 xpoints[index] = panel.xToPix(intersection[edge]) + 1;
                 break;
               case 5:
                 delta[edge] =
                     (contour_vertex[edge][1] - contour_vertex[nextedge][1])
                         * contour_stepz
                         / (contour_vertex[edge][2] - contour_vertex[nextedge][2]);
                 intersection[edge] =
                     (contour_vertex[edge][1] * (z - contour_vertex[nextedge][2])
                             + contour_vertex[nextedge][1] * (contour_vertex[edge][2] - z))
                         / (contour_vertex[edge][2] - contour_vertex[nextedge][2]);
                 xpoints[index] = xmax;
                 ypoints[index] = panel.yToPix(intersection[edge]) + 1;
                 break;
               case 7:
                 delta[edge] =
                     (contour_vertex[edge][0] - contour_vertex[nextedge][0])
                         * contour_stepz
                         / (contour_vertex[edge][2] - contour_vertex[nextedge][2]);
                 intersection[edge] =
                     (contour_vertex[edge][0] * (z - contour_vertex[nextedge][2])
                             + contour_vertex[nextedge][0] * (contour_vertex[edge][2] - z))
                         / (contour_vertex[edge][2] - contour_vertex[nextedge][2]);
                 xpoints[index] = panel.xToPix(intersection[edge]) + 1;
                 break;
             }
           }
         }
       }
     }
     // Creates polygon
     int contour_n = 0;
     for (int index = 0; index < 8; index++) {
       if (xpoints[index] >= 0) {
         contour_x[contour_n] = xpoints[index];
         contour_y[contour_n] = ypoints[index];
         contour_n++;
       }
     }
     if (showColoredLevels && (colorMap.getPaletteType() != ColorMapper.WIREFRAME)) {
       g.setColor(contourColors[counter]);
       if (contour_n > 0) {
         g.fillPolygon(contour_x, contour_y, contour_n);
       }
     }
     // Creates contour lines
     if (showContourLines) {
       int x = -1;
       int y = -1;
       for (int index = 1; index < 8; index += 2) {
         if (xpoints[index] >= 0) {
           if (x != -1) {
             accumulator.addLine(x, y, xpoints[index], ypoints[index]);
           }
           x = xpoints[index];
           y = ypoints[index];
         }
       }
       if ((xpoints[1] > 0) && (x != -1)) {
         accumulator.addLine(x, y, xpoints[1], ypoints[1]);
       }
     }
     if (contour_n < 3) {
       break;
     }
     z += contour_stepz;
   }
 }
Esempio n. 11
0
 /**
  * Paint the contour.
  *
  * @param g
  */
 public synchronized void draw(DrawingPanel panel, Graphics g) {
   if (!visible || (griddata == null)) {
     return;
   }
   if (!autoscaleZ) {
     g.setColor(colorMap.getFloorColor());
     int w = panel.getWidth() - panel.getLeftGutter() - panel.getRightGutter();
     int h = panel.getHeight() - panel.getTopGutter() - panel.getBottomGutter();
     g.fillRect(panel.getLeftGutter(), panel.getTopGutter(), Math.max(w, 0), Math.max(h, 0));
   }
   accumulator.clearAccumulator();
   contour_stepz = (zmax - zmin) / (contour_lines + 1);
   double z = zmin;
   for (int c = 0; c < contourColors.length; c++) {
     if (!autoscaleZ && (c == contourColors.length - 1)) {
       contourColors[c] = colorMap.getCeilColor();
     } else {
       contourColors[c] = colorMap.doubleToColor(z);
     }
     z += contour_stepz;
   }
   // double dx=griddata.getDx();
   // double dy=griddata.getDy();
   // double x = griddata.getLeft();
   double x = griddata.getLeft(), dx = (griddata.getRight() - griddata.getLeft()) / (nx - 1);
   double y = griddata.getTop(), dy = -(griddata.getTop() - griddata.getBottom()) / (ny - 1);
   for (int i = 0, mx = internalData.length - 1; i < mx; i++) {
     y = griddata.getTop();
     for (int j = 0, my = internalData[0].length - 1; j < my; j++) {
       contour_vertex[0][0] = x;
       contour_vertex[0][1] = y;
       contour_vertex[0][2] = internalData[i][j];
       contour_vertex[1][0] = x;
       contour_vertex[1][1] = y + dy;
       contour_vertex[1][2] = internalData[i][j + 1];
       contour_vertex[2][0] = x + dx;
       contour_vertex[2][1] = y + dy;
       contour_vertex[2][2] = internalData[i + 1][j + 1];
       contour_vertex[3][0] = x + dx;
       contour_vertex[3][1] = y;
       contour_vertex[3][2] = internalData[i + 1][j];
       createContour(panel, g);
       y += dy;
     }
     x += dx;
   }
   if (showContourLines) {
     g.setColor(lineColor);
     accumulator.drawAll(g);
     int lpix = panel.xToPix(griddata.getLeft());
     int tpix = panel.yToPix(griddata.getTop());
     int rpix = panel.xToPix(griddata.getRight());
     int bpix = panel.yToPix(griddata.getBottom());
     g.drawRect(
         Math.min(lpix, rpix), Math.min(tpix, bpix), Math.abs(lpix - rpix), Math.abs(tpix - bpix));
   }
 }
Esempio n. 12
0
 /**
  * Draw the image containing the dataset pixels.
  *
  * @param panel the panel containing this data raster
  * @param g the graphics context upon which to draw
  */
 public void draw(DrawingPanel panel, Graphics g) {
   if (!visible) {
     return;
   }
   if (primaryDrawingPanel != panel) {
     return; // can only draw on one panel for now.
   }
   int xrange = panel.xToPix(xmax) - panel.xToPix(xmin);
   int yrange = panel.yToPix(ymin) - panel.yToPix(ymax);
   xrange = Math.min(xrange, panel.getWidth());
   yrange = Math.min(yrange, panel.getHeight());
   if ((xrange == 0) || (xrange == 0)) {
     return;
   }
   // render a new image if the scale or image size change
   if ((Math.abs(xrange) != image.getWidth())
       || // image size change
       (Math.abs(yrange) != image.getHeight())
       || ( // image size change
       xppu != primaryDrawingPanel.getXPixPerUnit())
       || ( // scale change
       yppu != primaryDrawingPanel.getYPixPerUnit())) {
     render();
   }
   double xmin = Math.max(primaryDrawingPanel.getXMin(), this.xmin);
   double ymax = Math.min(primaryDrawingPanel.getYMax(), this.ymax);
   if ((image != null) && (image.getWidth() > 1)) {
     g.drawImage(
         image, panel.xToPix(xmin), panel.yToPix(ymax), panel); // blast the image into the panel
   }
 }
Esempio n. 13
0
 /**
  * Draws the axes in the drawing panel.
  *
  * @param panel
  * @param g
  */
 public void draw(DrawingPanel panel, Graphics g) {
   if (!visible) {
     return;
   }
   if (interiorColor != null) {
     g.setColor(interiorColor);
     int gw = panel.getLeftGutter() + panel.getRightGutter();
     int gh = panel.getTopGutter() + panel.getBottomGutter();
     g.fillRect(
         panel.getLeftGutter(),
         panel.getTopGutter(),
         panel.getWidth() - gw,
         panel.getHeight() - gh);
     g.setColor(Color.lightGray);
     g.drawRect(
         panel.getLeftGutter(),
         panel.getTopGutter(),
         panel.getWidth() - gw,
         panel.getHeight() - gh);
   }
   xaxis.draw(panel, g);
   yaxis.draw(panel, g);
   titleLine.setX((panel.getXMax() + panel.getXMin()) / 2);
   if (panel.getTopGutter() > 20) {
     titleLine.setY(panel.getYMax() + 5 / panel.getYPixPerUnit());
   } else {
     titleLine.setY(panel.getYMax() - 25 / panel.getYPixPerUnit());
   }
   titleLine.draw(panel, g);
 }
Esempio n. 14
0
  public void init(final Function function) {
    xAxis.clear();
    yAxis.clear();

    if (function != lastFunction) { // need to reset
      Slot.CIRCLE.clearList();
      Slot.CROSS.clearList();
      Slot.SQUARE.clearList();
      Slot.TRIANGLE.clearList();
    }

    data = new GridPointData(resolution, resolution, 1);
    plot = new InterpolatedPlot(data);

    useSlot.clearList();
    final List<List<ValuePointColored>> points = useSlot.getPoints();
    for (Slot slot : Slot.values()) {
      if (slot.isShow()) {
        for (List<ValuePointColored> valuePoints : slot.getPoints()) {
          for (ValuePointColored valuePoint : valuePoints) {
            xAxis.add(valuePoint);
            yAxis.add(valuePoint);
          }
        }
      }
    }

    // clean drawing panel
    drawablePanel.removeDrawables(InterpolatedPlot.class);
    drawablePanel.addDrawable(plot);

    datasetRecreation =
        new Closure() {

          public void execute(Object input) {
            List<ValuePointColored> vps = (List<ValuePointColored>) input;
            points.add(vps);
            for (ValuePointColored vp : vps) {
              xAxis.add(vp);
              yAxis.add(vp);
            }

            if (points.size() > maxPoints) {
              List<ValuePointColored> removed = points.remove(0);
              for (ValuePointColored valuePoint : removed) {
                xAxis.remove(valuePoint);
                yAxis.remove(valuePoint);
              }
            }

            // for ilustration
            if (xAxis.size() > 0 && yAxis.size() > 0) {
              double lowerXBound =
                  Math.min(
                      data.getLeft(), Math.floor(xAxis.first().getPoint().toArray()[0] - buffer));
              double upperXBound =
                  Math.max(
                      data.getRight(), Math.ceil(xAxis.last().getPoint().toArray()[0] + buffer));
              double lowerYBound =
                  Math.min(
                      data.getBottom(), Math.floor(yAxis.first().getPoint().toArray()[1] - buffer));
              double upperYBound =
                  Math.max(data.getTop(), Math.ceil(yAxis.last().getPoint().toArray()[1] + buffer));

              data.setScale(lowerXBound, upperXBound, lowerYBound, upperYBound);
              double[][][] xyz = data.getData();

              for (int i = 0; i < resolution; i++) {
                for (int j = 0; j < resolution; j++) {
                  Point p = Point.at(xyz[i][j]);
                  // check the cached value of the point
                  xyz[i][j][2] = /*cache.containsKey(p) ? cache.get(p) :*/ function.valueAt(p);
                }
              }
            }

            plot.setGridData(data);

            drawablePanel.repaint();
          }
        };

    lastFunction = function;

    // initialize to center point
    double lowerXBound = Math.floor(centerX - buffer);
    double upperXBound = Math.ceil(centerX + buffer);
    double lowerYBound = Math.floor(centerY - buffer);
    double upperYBound = Math.ceil(centerY + buffer);

    data.setScale(lowerXBound, upperXBound, lowerYBound, upperYBound);
    double[][][] xyz = data.getData();

    for (int i = 0; i < resolution; i++) {
      for (int j = 0; j < resolution; j++) {
        Point p = Point.at(xyz[i][j]);
        // check the cached value of the point
        xyz[i][j][2] = /*cache.containsKey(p) ? cache.get(p) :*/ function.valueAt(p);
      }
    }

    plot.setGridData(data);
    drawablePanel.repaint();
  }
Esempio n. 15
0
 public void centerAxes(DrawingPanel panel) {
   xaxis.setLocation((panel.getYMax() + panel.getYMin()) / 2);
   yaxis.setLocation((panel.getXMax() + panel.getXMin()) / 2);
 }
Esempio n. 16
0
 /**
  * Draws the axes in a drawing panel.
  *
  * @param panel
  * @param g
  */
 public void draw(DrawingPanel panel, Graphics g) {
   if (!visible) {
     return;
   }
   if (interiorColor != panel.getBackground()) {
     g.setColor(interiorColor);
     int gw = panel.getLeftGutter() + panel.getRightGutter();
     int gh = panel.getTopGutter() + panel.getLeftGutter();
     g.fillRect(
         panel.getLeftGutter(),
         panel.getTopGutter(),
         panel.getWidth() - gw,
         panel.getHeight() - gh);
     g.setColor(gridColor);
     g.drawRect(
         panel.getLeftGutter(),
         panel.getTopGutter(),
         panel.getWidth() - gw,
         panel.getHeight() - gh);
   }
   Iterator<Drawable> it = drawableList.iterator();
   while (it.hasNext()) {
     Drawable drawable = it.next();
     drawable.draw(panel, g);
   }
   titleLine.setX((panel.getXMax() + panel.getXMin()) / 2);
   if (panel.getTopGutter() > 20) {
     titleLine.setY(panel.getYMax() + 5 / panel.getYPixPerUnit());
   } else {
     titleLine.setY(panel.getYMax() - 25 / panel.getYPixPerUnit());
   }
   titleLine.draw(panel, g);
 }
Esempio n. 17
0
/*  Creates percolation cluster with probability p and computes mass distribution */
Esempio n. 18
0
 /**
  * Renders (draws) the panel immediately.
  *
  * <p>Unlike repaint, the render method is draws the panel within the calling method's thread.
  * This method is called automatically if the frame is animated.
  */
 public void render() {
   if (drawingPanel != null) {
     drawingPanel.render(); // simulations should render their panels at every time step
   }
 }