Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Ray3


  protected final ScatteringNode trace(ScatteredRay sr, double ru, double rv, double rj) {
    if (sr == null) {
      return null;
    }
    Scene scene = pathInfo.getScene();
    Ray3 ray = sr.getRay();
    SceneElement root = scene.getRoot();
    Intersection x = NearestIntersectionRecorder
        .computeNearestIntersection(ray, root);
    if (x != null) {
      ShadingContext context = new MinimalShadingContext(Random.DEFAULT);
View Full Code Here


      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;

      if (grandChild != null) {
        double rpdf = grandChild.getReversePDF();
        double pdf = grandChild.getPDF();
View Full Code Here

          / v.squaredLength();
    }
  }

  public static boolean visibility(PathNode a, PathNode b) {
    Ray3 ray = Ray3.create(a.getPosition(), b.getPosition());
    if (ray != null) {
      PathInfo path = a.getPathInfo();
      VisibilityFunction3 vf = path.getScene().getRoot();
      return vf.visibility(ray);
    } else { // ray == null
View Full Code Here

      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;

      if (grandChild != null) {
        double rpdf = grandChild.getReversePDF();
        double pdf = grandChild.getPDF();
View Full Code Here

        out = Optics.reflect(v, h);
      } while (n.dot(out) <= 0.0);

    }

    Ray3 ray = new Ray3(x.getPosition(), out);
    double pdf = getScatteringPDF(x, v, out, true, lambda);
    Color value = bsdf(x, v, out, lambda).divide(pdf);

    return ScatteredRay.diffuse(ray, value, pdf);
View Full Code Here

      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

   * @param direction The <code>Vector3</code> indicating the direction of
   *     the ray.
   * @param power The <code>Color</code>.
   */
  public Photon(Point3 position, Vector3 direction, Color power) {
    this(new Ray3(position, direction), power);
  }
View Full Code Here

      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));
      }
      Ray3 ray = new Ray3(o, v);
      Color color = getWhite();
      return ScatteredRay.diffuse(ray, color, 1.0 / Math.PI);
    }
View Full Code Here

    public ScatteredRay sample(double ru, double rv, double rj) {
      Point2 p = pointOnImagePlane;
      SphericalCoordinates v = new SphericalCoordinates(
          Math.acos(1.0 - 2.0 * p.y()),
          2.0 * Math.PI * p.x());
      Ray3 ray = new Ray3(Point3.ORIGIN, v.toCartesian(BASIS));
      Color color = getWhite();
      double pdf = 1.0 / (4.0 * Math.PI);

      return ScatteredRay.diffuse(ray, color, pdf);
    }
View Full Code Here

    /* (non-Javadoc)
     * @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);
View Full Code Here

TOP

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

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.