Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Box3


    if (this.isEmpty()) {
      return Box3.EMPTY;
    }

    // FIXME epsilon checks should not be done at this level.
    return new Box3(minimumX - MathUtil.EPSILON, minimumY - MathUtil.EPSILON, minimumZ - MathUtil.EPSILON, maximumX + MathUtil.EPSILON, maximumY + MathUtil.EPSILON, maximumZ + MathUtil.EPSILON);
  }
View Full Code Here


   *     direction in which the bounding box of all the nodes is the
   *     longest.
   */
  private Comparator<Node> getComparator(Node[] nodes, int fromIndex, int toIndex) {

    Box3 bound = getBoundingBox(nodes, fromIndex, toIndex);

    if (bound.lengthX() > bound.lengthY() && bound.lengthX() > bound.lengthZ()) {
      return COMPARATORS[NodeComparator.X_AXIS];
    } else if (bound.lengthY() > bound.lengthZ()) {
      return COMPARATORS[NodeComparator.Y_AXIS];
    } else {
      return COMPARATORS[NodeComparator.Z_AXIS];
    }

View Full Code Here

   * @see #hasCellAt(int, int, int)
   */
  public Box3 cellBounds(int cx, int cy, int cz) {
    assert(this.hasCellAt(cx, cy, cz));

    return new Box3(
      bound.minimumX() + (double) cx * dx,
      bound.minimumY() + (double) cy * dy,
      bound.minimumZ() + (double) cz * dz,
      bound.minimumX() + (double) (cx + 1) * dx,
      bound.minimumY() + (double) (cy + 1) * dy,
 
View Full Code Here

    if (bound != null) {
      return;
    }
    BoundingBoxBuilder3 bbox = new BoundingBoxBuilder3();
    for (int i = 0, n = super.getNumPrimitives(); i < n; i++) {
      Box3 b = super.getBoundingBox(i);
      for (int j = 0; j < 8; j++) {
        bbox.add(t.apply(b.corner(j)));
      }
    }
    bound = bbox.getBoundingBox();
  }
View Full Code Here

   * @see ca.eandb.jmist.framework.scene.SceneElementDecorator#getBoundingBox(int)
   */
  @Override
  public Box3 getBoundingBox(int index) {
    BoundingBoxBuilder3 bbox = new BoundingBoxBuilder3();
    Box3 b = super.getBoundingBox(index);
    for (int j = 0; j < 8; j++) {
      bbox.add(t.apply(b.corner(j)));
    }
    return bbox.getBoundingBox();
  }
View Full Code Here

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.scene.SceneElementDecorator#getBoundingSphere(int)
   */
  @Override
  public Sphere getBoundingSphere(int index) {
    Box3 b = super.getBoundingBox(index);
    return new Sphere(b.center(), b.diagonal() / 2.0);
  }
View Full Code Here

  private final SceneElement root;

  public BoxFurnaceScene(Spectrum reflectance, Spectrum emittance) {
    root = new MaterialSceneElement(
        new LambertianMaterial(reflectance, emittance),
        new InsideOutGeometry(new BoxGeometry(new Box3(-1, -1, -1, 1, 1, 1))));
  }
View Full Code Here

    if (height.rows() < 2 || height.columns() < 2) {
      throw new IllegalArgumentException("height must have at least two rows and two columns");
    }

    Box3 bounds = new Box3(xz.spanX(), height.range().expand(MathUtil.EPSILON), xz.spanY());
    this.grid = new Grid3(bounds, height.rows() - 1, 1, height.columns() - 1);
    this.height = height;
  }
View Full Code Here

        /* If the range of y-values intersect, then there may be an
         * intersection.
         */
        if (h.intersects(slice.range())) {

          Box3 bounds = cell.getBoundingBox();

          /* Get the points on the height field. */
          Point3 p00 = new Point3(bounds.minimumX(), slice.at(0, 0), bounds.minimumZ());
          Point3 p01 = new Point3(bounds.minimumX(), slice.at(0, 1), bounds.maximumZ());
          Point3 p10 = new Point3(bounds.maximumX(), slice.at(1, 0), bounds.minimumZ());
          Point3 p11 = new Point3(bounds.maximumX(), slice.at(1, 1), bounds.maximumZ());

          Plane3 plane;
          double t;

          /* Divide the four points into two triangles and check for
View Full Code Here

   * @see ca.eandb.jmist.framework.AbstractGeometry#getTextureCoordinates(ca.eandb.jmist.framework.AbstractGeometry.GeometryIntersection)
   */
  @Override
  protected Point2 getTextureCoordinates(GeometryIntersection x) {
    Point3 p = x.getPosition();
    Box3 bounds = grid.getBoundingBox();
    return new Point2(
        (p.x() - bounds.minimumX()) / (bounds.maximumX() - bounds.minimumX()),
        (p.z() - bounds.minimumZ()) / (bounds.maximumZ() - bounds.minimumZ())
    );
  }
View Full Code Here

TOP

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

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.