Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Box2


  public Box2 getBoundingBox() {
    if (this.isEmpty()) {
      return Box2.EMPTY;
    }

    return new Box2(minimumX, minimumY, maximumX, maximumY);
  }
View Full Code Here


    public Object performTask(Object task, ProgressMonitor monitor) {

      Cell  cell        = (Cell) task;
      int    numPixels      = cell.width * cell.height;
      Color  pixel;
      Box2  bounds;
      double  x0, y0, x1, y1;
      double  w          = width;
      double  h          = height;
      Raster  raster        = colorModel.createRaster(cell.width, cell.height);

      for (int n = 0, y = cell.y; y < cell.y + cell.height; y++) {

        if (!monitor.notifyProgress(n, numPixels))
          return null;

        y0      = (double) y / h;
        y1      = (double) (y + 1) / h;

        for (int x = cell.x; x < cell.x + cell.width; x++, n++) {

          x0    = (double) x / w;
          x1    = (double) (x + 1) / w;

          bounds  = new Box2(x0, y0, x1, y1);

          pixel = pixelShader.shadePixel(bounds);
          raster.addPixel(x - cell.x, y - cell.y, pixel);

        }
View Full Code Here

     * @see ca.eandb.jdcp.job.TaskWorker#performTask(java.lang.Object, ca.eandb.util.progress.ProgressMonitor)
     */
    public Object performTask(Object task, ProgressMonitor monitor) {

      int      passes        = (Integer) task;
      Box2    bounds;
      double    x0, y0, x1, y1;
      double    w          = width;
      double    h          = height;
      int      numPixels      = width * height;
      int      samplesPerPixel    = passes * lightPathsPerEyePath;
      double    lightImageWeight  = 1.0 / (double) samplesPerPixel;
      Light    light        = scene.getLight();
      Lens    lens        = scene.getLens();
      Animator  animator      = scene.getAnimator();

      initialize();
      raster.get().clear();

      for (int n = 0, y = 0; y < height; y++) {

        if (!monitor.notifyProgress(n, numPixels))
          return null;

        y0      = (double) y / h;
        y1      = (double) (y + 1) / h;

        for (int x = 0; x < width; x++, n++) {

          x0      = (double) x / w;
          x1      = (double) (x + 1) / w;

          bounds    = new Box2(x0, y0, x1, y1);

          for (int i = 0; i < passes; i++) {

            if (shutter != null) {
              double time    = RandomUtil.uniform(shutter, random);
View Full Code Here

          builder.reset();
          builder.add(a);
          builder.add(b);
          builder.add(c);

          Box2 bound = builder.getBoundingBox();

          int i0 = MathUtil.clamp((int) Math.floor(bound.minimumX() * (double) triangleLookupGridSize), 0, triangleLookupGridSize - 1);
          int i1 = MathUtil.clamp((int) Math.floor(bound.maximumX() * (double) triangleLookupGridSize), 0, triangleLookupGridSize - 1);
          int j0 = MathUtil.clamp((int) Math.floor(bound.minimumY() * (double) triangleLookupGridSize), 0, triangleLookupGridSize - 1);
          int j1 = MathUtil.clamp((int) Math.floor(bound.maximumY() * (double) triangleLookupGridSize), 0, triangleLookupGridSize - 1);

          for (int i = i0; i <= i1; i++) {
            double x0 = (double) i / (double) triangleLookupGridSize;
            double x1 = (double) (i + 1) / (double) triangleLookupGridSize;

            for (int j = j0; j <= j1; j++) {
              double y0 = (double) j / (double) triangleLookupGridSize;
              double y1 = (double) (j + 1) / (double) triangleLookupGridSize;

              Box2 cell = new Box2(x0, y0, x1, y1);

              if (GeometryUtil.boxIntersectsTriangle(cell, a, b, c)) {
                int cellIndex = j * triangleLookupGridSize + i;
                int triIndex = fi * maximumTrianglesPerFace + tri / 3;
                IntegerArray list = triangleLookup.get(cellIndex);
View Full Code Here

   */
  public Color shadePixel(Box2 bounds) {
    double x0, x1, y0, y1;
    Color pixel = null;
    Color sample;
    Box2 subpixel;

    for (int i = 0; i < this.rows; i++) {
      x0 = bounds.interpolateX((double) i / (double) this.rows);
      x1 = bounds.interpolateX((double) (i + 1) / (double) this.rows);

      for (int j = 0; j < this.columns; j++) {
        y0 = bounds.interpolateY((double) j / (double) this.columns);
        y1 = bounds.interpolateY((double) (j + 1) / (double) this.columns);

        subpixel = new Box2(x0, y0, x1, y1);
        sample = pixelShader.shadePixel(subpixel);
        pixel = add(pixel, sample);
      }
    }

View Full Code Here

TOP

Related Classes of ca.eandb.jmist.math.Box2

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.