Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Point3.x()


            /* Get the normalized (x,z) coordinates, (cx, cz),
             * within the bounds of the cell.  If cx < cz, then
             * the intersection hit the triangle, otherwise, it hit
             * the plane, but on the other half of the cell.
             */
            double cx = (p.x() - p00.x()) / (p10.x() - p00.x());
            double cz = (p.z() - p10.z()) / (p11.z() - p10.z());

            if (cx < cz) {
              Intersection x = newIntersection(ray, t, ray.direction().dot(plane.normal()) < 0.0)
                .setBasis(Basis3.fromW(plane.normal(), Basis3.Orientation.RIGHT_HANDED))
View Full Code Here


  @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())
    );
  }

  /* (non-Javadoc)
 
View Full Code Here

      if (ray.direction().y() != 0.0) {
        t = (box.minimumY() - ray.origin().y()) / ray.direction().y();
        if (t > 0.0) {
          p = ray.pointAt(t);
          if (box.minimumX() < p.x() && p.x() < box.maximumX() && box.minimumZ() < p.z() && p.z() < box.maximumZ()) {
            Intersection x = super.newIntersection(ray, t, ray.direction().y() > 0.0, BOX_SURFACE_MIN_Y)
              .setLocation(p);
            recorder.record(x);
            if (++n == 2) return;
          }
View Full Code Here

      if (ray.direction().y() != 0.0) {
        t = (box.minimumY() - ray.origin().y()) / ray.direction().y();
        if (t > 0.0) {
          p = ray.pointAt(t);
          if (box.minimumX() < p.x() && p.x() < box.maximumX() && box.minimumZ() < p.z() && p.z() < box.maximumZ()) {
            Intersection x = super.newIntersection(ray, t, ray.direction().y() > 0.0, BOX_SURFACE_MIN_Y)
              .setLocation(p);
            recorder.record(x);
            if (++n == 2) return;
          }
View Full Code Here

        }

        t = (box.maximumY() - ray.origin().y()) / ray.direction().y();
        if (t > 0.0) {
          p = ray.pointAt(t);
          if (box.minimumX() < p.x() && p.x() < box.maximumX() && box.minimumZ() < p.z() && p.z() < box.maximumZ()) {
            Intersection x = super.newIntersection(ray, t, ray.direction().y() < 0.0, BOX_SURFACE_MAX_Y)
              .setLocation(p);
            recorder.record(x);
            if (++n == 2) return;
          }
View Full Code Here

        }

        t = (box.maximumY() - ray.origin().y()) / ray.direction().y();
        if (t > 0.0) {
          p = ray.pointAt(t);
          if (box.minimumX() < p.x() && p.x() < box.maximumX() && box.minimumZ() < p.z() && p.z() < box.maximumZ()) {
            Intersection x = super.newIntersection(ray, t, ray.direction().y() < 0.0, BOX_SURFACE_MAX_Y)
              .setLocation(p);
            recorder.record(x);
            if (++n == 2) return;
          }
View Full Code Here

      if (ray.direction().z() != 0.0) {
        t = (box.minimumZ() - ray.origin().z()) / ray.direction().z();
        if (t > 0.0) {
          p = ray.pointAt(t);
          if (box.minimumX() < p.x() && p.x() < box.maximumX() && box.minimumY() < p.y() && p.y() < box.maximumY()) {
            Intersection x = super.newIntersection(ray, t, ray.direction().z() > 0.0, BOX_SURFACE_MIN_Z)
              .setLocation(p);
            recorder.record(x);
            if (++n == 2) return;
          }
View Full Code Here

      if (ray.direction().z() != 0.0) {
        t = (box.minimumZ() - ray.origin().z()) / ray.direction().z();
        if (t > 0.0) {
          p = ray.pointAt(t);
          if (box.minimumX() < p.x() && p.x() < box.maximumX() && box.minimumY() < p.y() && p.y() < box.maximumY()) {
            Intersection x = super.newIntersection(ray, t, ray.direction().z() > 0.0, BOX_SURFACE_MIN_Z)
              .setLocation(p);
            recorder.record(x);
            if (++n == 2) return;
          }
View Full Code Here

        }

        t = (box.maximumZ() - ray.origin().z()) / ray.direction().z();
        if (t > 0.0) {
          p = ray.pointAt(t);
          if (box.minimumX() < p.x() && p.x() < box.maximumX() && box.minimumY() < p.y() && p.y() < box.maximumY()) {
            Intersection x = super.newIntersection(ray, t, ray.direction().z() < 0.0, BOX_SURFACE_MAX_Z)
              .setLocation(p);
            recorder.record(x);
            if (++n == 2) return;
          }
View Full Code Here

        }

        t = (box.maximumZ() - ray.origin().z()) / ray.direction().z();
        if (t > 0.0) {
          p = ray.pointAt(t);
          if (box.minimumX() < p.x() && p.x() < box.maximumX() && box.minimumY() < p.y() && p.y() < box.maximumY()) {
            Intersection x = super.newIntersection(ray, t, ray.direction().z() < 0.0, BOX_SURFACE_MAX_Z)
              .setLocation(p);
            recorder.record(x);
            if (++n == 2) return;
          }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.