Package ca.eandb.jmist.math

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


          width * (p.x() - 0.5),
          height * (0.5 - p.y()),
          -1.0);
      Ray3 ray = new Ray3(Point3.ORIGIN, v.unit());
      Color color = getWhite();
      double z = v.x() * v.x() + v.y() * v.y() + 1.0;
      double pdf = z * z / (width * height);
      return ScatteredRay.diffuse(ray, color, pdf);
    }

    /* (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

    if (wavelength < 400e-9) {
      value = 0.0;
    } 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;
    }
View Full Code Here

  @Override
  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),
 
View Full Code Here

      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) {
        return null;
      }
      return new Point2(
          0.5 + theta / hfov,
View Full Code Here

      if (-v.z() / d < MathUtil.EPSILON) {
        return null;
      }
      return new Point2(
          (v.x() / d + 1.0) / 2.0,
          (1.0 - v.y() / d) / 2.0);
    }

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

  }

  public static CIEXYZ convertRGB2XYZ(double r, double g, double b) {
    Vector3 rgb = new Vector3(linearize(r), linearize(g), linearize(b));
    Vector3 xyz = sRGBLin_TO_XYZ.times(rgb);
    return new CIEXYZ(xyz.x(), xyz.y(), xyz.z());
  }

  public static CIEXYZ convertRGB2XYZ(RGB rgb) {
    return convertRGB2XYZ(rgb.r(), rgb.g(), rgb.b());
  }
View Full Code Here

  public static RGB convertXYZ2RGB(double x, double y, double z) {
    Vector3 xyz = new Vector3(x, y, z);
    Vector3 rgb = XYZ_TO_sRGBLin.times(xyz);
    return new RGB(
        delinearize(rgb.x()),
        delinearize(rgb.y()),
        delinearize(rgb.z()));
  }

  public static RGB convertXYZ2RGB(CIEXYZ xyz) {
    return convertXYZ2RGB(xyz.X(), xyz.Y(), xyz.Z());
View Full Code Here

      Vector3 v = ray.direction().unit();
      double phi = Math.atan2(v.x(), -v.z());
      if (Math.abs(phi) > 0.5 * hfov) {
        return null;
      }
      double theta = Math.asin(v.y());
      if (Math.abs(theta) > 0.5 * vfov) {
        return null;
      }
      return new Point2(
          0.5 + phi / hfov,
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.