Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Point3


              "grandChild and newParent.getParent() are different.");
        }
      }

      Vector3 v = PathUtil.getDirection(newParent, this);
      Point3 origin = newParent.isAtInfinity()
          ? surf.getPosition().minus(v)
          : newParent.getPosition().toPoint3();
      Ray3 ray = new Ray3(origin, v);
      ScatteredRay sr;
View Full Code Here


      return Math.max(a.getCosine(v), 0.0);
    } else if (aAtInf) {
      Vector3 v = (Vector3) a.getPosition();
      return Math.max(b.getCosine(v), 0.0);
    } else {
      Point3 p = (Point3) a.getPosition();
      Point3 q = (Point3) b.getPosition();
      Vector3 v = p.vectorTo(q);
      return Math.max(a.getCosine(v), 0.0) * Math.max(b.getCosine(v.opposite()), 0.0)
          / v.squaredLength();
    }
  }
View Full Code Here

              "grandChild and newParent.getParent() are different.");
        }
      }

      Vector3 v = PathUtil.getDirection(newParent, this);
      Point3 origin = newParent.isAtInfinity()
          ? surf.getPosition().minus(v)
          : newParent.getPosition().toPoint3();
      Ray3 ray = new Ray3(origin, v);
      ScatteredRay sr;
View Full Code Here

   * @param sphere The sphere to include in the bounding box.
   */
  public void add(Sphere sphere) {
    if (!sphere.isEmpty()) {
      double r = sphere.radius();
      Point3 c = sphere.center();

      if (this.isEmpty()) {
        minimumX = c.x() - r;
        minimumY = c.y() - r;
        minimumZ = c.z() - r;
        maximumX = c.x() + r;
        maximumY = c.y() + r;
        maximumZ = c.z() + r;
      } else {
        minimumX = Math.min(c.x() - r, minimumX);
        minimumY = Math.min(c.y() - r, minimumY);
        minimumZ = Math.min(c.z() - r, minimumZ);
        maximumX = Math.max(c.x() + r, maximumX);
        maximumY = Math.max(c.y() + r, maximumY);
        maximumZ = Math.max(c.z() + r, maximumZ);
      }
    }
  }
View Full Code Here

      double cost2 = Math.cos(theta2);
      double sint2 = Math.sin(theta2);
      double cost3 = Math.cos(theta3);
      double sint3 = Math.sin(theta3);

      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 ScatteredRay sample(double ru, double rv, double rj) {
      if (weight < 0.0) {
        return null;
      }
      Point3 o = context.getPosition();
      Vector3 ns = context.getShadingNormal();
      Vector3 ng = context.getNormal();
      Vector3 v = RandomUtil.diffuse(ru, rv).toCartesian(Basis3.fromW(ns));
      while (ng.dot(v) < 0.0) {
        v = RandomUtil.diffuse(Random.DEFAULT).toCartesian(Basis3.fromW(ns));
View Full Code Here

    /* (non-Javadoc)
     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
     */
    public int compare(Node o1, Node o2) {
      Point3 p1 = o1.bound.center();
      Point3 p2 = o2.bound.center();

      switch (this.axis) {
      case X_AXIS: return Double.compare(p1.x(), p2.x());
      case Y_AXIS: return Double.compare(p1.y(), p2.y());
      case Z_AXIS: return Double.compare(p1.z(), p2.z());
      }

      throw new UnsupportedOperationException("invalid axis");
    }
View Full Code Here

     * @see ca.eandb.jmist.framework.path.EyeNode#sample(ca.eandb.jmist.math.Point2, ca.eandb.jmist.framework.Random)
     */
    public ScatteredRay sample(double ru, double rv, double rj) {
      Point2 p = pointOnImagePlane;
      Ray3 ray = new Ray3(
          new Point3(
            (p.x() - 0.5) * width,
            (0.5 - p.y()) * height,
            0.0),
          Vector3.NEGATIVE_K);
      Color color = getWhite();
View Full Code Here

     */
    public Point2 project(HPoint3 x) {
      if (!x.isPoint()) {
        return null;
      }
      Point3 p = x.toPoint3();
      return new Point2(0.5 + p.x() / width, 0.5 - p.y() / height);
    }
View Full Code Here

    /* (non-Javadoc)
     * @see ca.eandb.jmist.framework.path.PathNode#getPosition()
     */
    public HPoint3 getPosition() {
      Point2 p = pointOnImagePlane;
      return new Point3(
          (p.x() - 0.5) * width,
          (0.5 - p.y()) * height,
          0.0);
    }
View Full Code Here

TOP

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

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.