Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Plane3


      Point3 p = new Point3(halfTableDiag * cost1, halfTableDiag * sint1, 0.0);
      Point3 q = new Point3(radius * cost1, radius * sint1, -crownHeight);
      Point3 r;

      Basis3 basis = Basis3.fromUW(p.vectorTo(q), Vector3.K);
      Plane3 planeKite = Plane3.throughPoint(p, basis);

      b.slice(planeKite, true);

      q = new Point3(halfTableDiag * cost3, halfTableDiag * sint3, 0.0);
      r = new Point3(starPointRadius * cost2, starPointRadius * sint2, 0.0);

      Ray3 ray = new Ray3(r, Vector3.K);
      r = ray.pointAt(planeKite.intersect(ray));

      Plane3 planeStar = Plane3.throughPoints(q, p, r);
      b.slice(planeStar, true);

      p = new Point3(radius * cost2, radius * sint2, -crownHeight);
      q = new Point3(radius * cost1, radius * sint1, -crownHeight);

      Plane3 planeGirdle = Plane3.throughPoints(q, p, r);
      b.slice(planeGirdle, true);

      q = new Point3(radius * cost3, radius * sint3, -crownHeight);
      planeGirdle = Plane3.throughPoints(p, q, r);
      b.slice(planeGirdle, true);

      p = new Point3(radius * cost1, radius * sint1, lowerMainTop);
      q = new Point3(0.0, 0.0, lowerMainTop - pavilionPointDepth);
      basis = Basis3.fromUW(p.vectorTo(q), Vector3.NEGATIVE_K);

      Plane3 planeMain = Plane3.throughPoint(p, basis);
      b.slice(planeMain, true);

      q = new Point3(radius * cost0, radius * sint0, lowerMainTop);
      r = new Point3(lowerGirdleInner * cost0, lowerGirdleInner * sint0, 0.0);
      ray = new Ray3(r, Vector3.NEGATIVE_K);
      r = ray.pointAt(planeMain.intersect(ray));

      planeGirdle = Plane3.throughPoints(p, q, r);
      b.slice(planeGirdle, true);

      q = new Point3(radius * cost2, radius * sint2, lowerMainTop);
      r = new Point3(lowerGirdleInner * cost2, lowerGirdleInner * sint2, 0.0);
      ray = new Ray3(r, Vector3.NEGATIVE_K);
      r = ray.pointAt(planeMain.intersect(ray));
      planeGirdle = Plane3.throughPoints(q, p, r);
      b.slice(planeGirdle, true);

    }

View Full Code Here


            }
            public boolean isFront() {
              return true;
            }
            public void prepareShadingContext(ShadingContext context) {
              Plane3 plane = Plane3.throughPoints(vertices[vertexIndex], vertices[vertexIndex+1], vertices[vertexIndex+2]);
              Vector3 n = plane.normal();
              Vector3 v = ray.direction();
              context.setPosition(ray.pointAt(t));
              context.setNormal(v.dot(n) > 0.0 ? n.opposite() : n);
              context.setMaterial(hairMaterial != null ? hairMaterial : emitterContext.getMaterial());
              context.setModifier(emitterContext.getModifier());
View Full Code Here

          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
           * an intersection with each triangle.
           */
          plane = Plane3.throughPoints(p00, p10, p11);
          t = plane.intersect(ray);

          if (I.contains(t)) {
            Point3 p = ray.pointAt(t);

            /* 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))
                .setLocation(p);

              recorder.record(x);

              hit = true;
            }
          }

          plane = Plane3.throughPoints(p00, p11, p01);
          t = plane.intersect(ray);

          if (I.contains(t)) {
            Point3 p = ray.pointAt(t);

            /* 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))
                .setLocation(p);

              recorder.record(x);

              hit = true;
View Full Code Here

TOP

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

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.