Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Vector3.z()


    @Override
    public ScatteredRay sample(double ru, double rv, double rj) {
      Vector3 v = ray.direction();
      Color color = getWhite();
      double pdf = (focusDistance * focusDistance)
          / (v.z() * v.z() * v.z() * v.z() * objPlaneWidth * objPlaneHeight);
      return ScatteredRay.diffuse(ray, color, pdf);
    }

    /* (non-Javadoc)
     * @see ca.eandb.jmist.framework.path.PathNode#scatter(ca.eandb.jmist.math.Vector3)
View Full Code Here


    @Override
    public ScatteredRay sample(double ru, double rv, double rj) {
      Vector3 v = ray.direction();
      Color color = getWhite();
      double pdf = (focusDistance * focusDistance)
          / (v.z() * v.z() * v.z() * v.z() * objPlaneWidth * objPlaneHeight);
      return ScatteredRay.diffuse(ray, color, pdf);
    }

    /* (non-Javadoc)
     * @see ca.eandb.jmist.framework.path.PathNode#scatter(ca.eandb.jmist.math.Vector3)
View Full Code Here

    @Override
    public ScatteredRay sample(double ru, double rv, double rj) {
      Vector3 v = ray.direction();
      Color color = getWhite();
      double pdf = (focusDistance * focusDistance)
          / (v.z() * v.z() * v.z() * v.z() * objPlaneWidth * objPlaneHeight);
      return ScatteredRay.diffuse(ray, color, pdf);
    }

    /* (non-Javadoc)
     * @see ca.eandb.jmist.framework.path.PathNode#scatter(ca.eandb.jmist.math.Vector3)
View Full Code Here

     * @see ca.eandb.jmist.framework.path.EyeNode#project(ca.eandb.jmist.math.HPoint3)
     */
    public Point2 project(HPoint3 x) {
      Ray3 ray = new Ray3(Point3.ORIGIN, x);
      Vector3 v = ray.direction();
      if (-v.z() < MathUtil.EPSILON) {
        return null;
      }
      Point2 p = new Point2(
          0.5 - v.x() / (width * v.z()),
          0.5 + v.y() / (height * v.z()));
 
View Full Code Here

      Vector3 v = ray.direction();
      if (-v.z() < MathUtil.EPSILON) {
        return null;
      }
      Point2 p = new Point2(
          0.5 - v.x() / (width * v.z()),
          0.5 + v.y() / (height * v.z()));
      return Box2.UNIT.contains(p) ? p : null;
    }

    /* (non-Javadoc)
 
View Full Code Here

      if (-v.z() < MathUtil.EPSILON) {
        return null;
      }
      Point2 p = new Point2(
          0.5 - v.x() / (width * v.z()),
          0.5 + v.y() / (height * v.z()));
      return Box2.UNIT.contains(p) ? p : null;
    }

    /* (non-Javadoc)
     * @see ca.eandb.jmist.framework.path.PathNode#getCosine(ca.eandb.jmist.math.Vector3)
View Full Code Here

    } else if (wavelength < 500e-9) {
      value = Math.max(0.0, band.x());
    } else if (wavelength < 600e-9) {
      value = Math.max(0.0, band.y());
    } else if (wavelength < 700e-9) {
      value = Math.max(0.0, band.z());
    } else { // wavelength >= 700e-9
      value = 0.0;
    }

    return new XYZSample(value, lambda);
View Full Code Here

  public Color shade(ShadingContext sc) {
    Vector3 n = sc.getShadingNormal();

    double r = Math.abs(n.x());
    double g = Math.abs(n.y());
    double b = Math.abs(n.z());

    double c = Math.max(r, Math.max(g, b));

    return sc.getColorModel().fromRGB(r / c, g / c, b / c).sample(sc.getWavelengthPacket());
  }
View Full Code Here

    double x0 = org.x() / radius;
    double y0 = org.y() / height - 1.0;
    double z0 = org.z() / radius;
    double x1 = dir.x() / radius;
    double y1 = dir.y() / height;
    double z1 = dir.z() / radius;

    Polynomial f = new Polynomial(
        x0 * x0 - y0 * y0 + z0 * z0,
        2.0 * (x0 * x1 - y0 * y1 + z0 * z1),
        x1 * x1 - y1 * y1 + z1 * z1);
 
View Full Code Here

     * @see ca.eandb.jmist.framework.path.EyeNode#project(ca.eandb.jmist.math.HPoint3)
     */
    public Point2 project(HPoint3 x) {
      Ray3 ray = new Ray3(Point3.ORIGIN, x);
      Vector3 v = ray.direction();
      double theta = Math.atan2(v.x(), -v.z());
      if (Math.abs(theta) > 0.5 * hfov) {
        return null;
      }
      double h = v.y() / Math.hypot(v.x(), v.z());
      if (Math.abs(h) > 0.5 * height) {
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.