Package ca.eandb.jmist.math

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


   */
  @Override
  public double getScatteringPDF(SurfacePoint x, Vector3 in, Vector3 out,
      boolean adjoint, WavelengthPacket lambda) {
    Vector3 n = x.getNormal();
    double ndoti = -n.dot(in);
    double ndoto = n.dot(out);
    boolean reflected = (ndoti / ndoto) > 0.0;

    if (reflected) {
      Vector3 hr = out.minus(in).times(Math.signum(ndoti)).unit();
View Full Code Here


  @Override
  public double getScatteringPDF(SurfacePoint x, Vector3 in, Vector3 out,
      boolean adjoint, WavelengthPacket lambda) {
    Vector3 n = x.getNormal();
    double ndoti = -n.dot(in);
    double ndoto = n.dot(out);
    boolean reflected = (ndoti / ndoto) > 0.0;

    if (reflected) {
      Vector3 hr = out.minus(in).times(Math.signum(ndoti)).unit();
      hr = hr.dot(n) > 0.0 ? hr : hr.opposite();
View Full Code Here

    double ndoto = n.dot(out);
    boolean reflected = (ndoti / ndoto) > 0.0;

    if (reflected) {
      Vector3 hr = out.minus(in).times(Math.signum(ndoti)).unit();
      hr = hr.dot(n) > 0.0 ? hr : hr.opposite();

      double partial = 1.0 / (4.0 * Math.abs(hr.dot(out)));
      double d = microfacets.getDistributionPDF(hr, n);
      double pm = d * Math.abs(hr.dot(n));
      double po = pm * partial;
 
View Full Code Here

    if (reflected) {
      Vector3 hr = out.minus(in).times(Math.signum(ndoti)).unit();
      hr = hr.dot(n) > 0.0 ? hr : hr.opposite();

      double partial = 1.0 / (4.0 * Math.abs(hr.dot(out)));
      double d = microfacets.getDistributionPDF(hr, n);
      double pm = d * Math.abs(hr.dot(n));
      double po = pm * partial;
      return po;// / Math.abs(n.dot(out));
    } else {
View Full Code Here

      Vector3 hr = out.minus(in).times(Math.signum(ndoti)).unit();
      hr = hr.dot(n) > 0.0 ? hr : hr.opposite();

      double partial = 1.0 / (4.0 * Math.abs(hr.dot(out)));
      double d = microfacets.getDistributionPDF(hr, n);
      double pm = d * Math.abs(hr.dot(n));
      double po = pm * partial;
      return po;// / Math.abs(n.dot(out));
    } else {
      double ni, no;

View Full Code Here

        no = n1;
      }

      //Vector3 ht = out.times(no).minus(in.times(ni)).unit();
      Vector3 ht = in.times(ni).minus(out.times(no)).unit();
      ht = ht.dot(n) > 0.0 ? ht : ht.opposite();

      double hdoti = -ht.dot(in);
      double hdoto = ht.dot(out);

      double k = Math.abs(hdoti * hdoto / (ndoti * ndoto));
 
View Full Code Here

      //Vector3 ht = out.times(no).minus(in.times(ni)).unit();
      Vector3 ht = in.times(ni).minus(out.times(no)).unit();
      ht = ht.dot(n) > 0.0 ? ht : ht.opposite();

      double hdoti = -ht.dot(in);
      double hdoto = ht.dot(out);

      double k = Math.abs(hdoti * hdoto / (ndoti * ndoto));
      double c = ni * hdoti + no * hdoto;

 
View Full Code Here

      //Vector3 ht = out.times(no).minus(in.times(ni)).unit();
      Vector3 ht = in.times(ni).minus(out.times(no)).unit();
      ht = ht.dot(n) > 0.0 ? ht : ht.opposite();

      double hdoti = -ht.dot(in);
      double hdoto = ht.dot(out);

      double k = Math.abs(hdoti * hdoto / (ndoti * ndoto));
      double c = ni * hdoti + no * hdoto;

      double partial = no * no * Math.abs(hdoto) / (c * c);
 
View Full Code Here

      double k = Math.abs(hdoti * hdoto / (ndoti * ndoto));
      double c = ni * hdoti + no * hdoto;

      double partial = no * no * Math.abs(hdoto) / (c * c);
      double d = microfacets.getDistributionPDF(ht, n);
      double pm = d * Math.abs(ht.dot(n));
      double po = pm * partial;
      return po;// / Math.abs(n.dot(out));
    }
  }

View Full Code Here

  public ScatteredRay scatter(SurfacePoint x, Vector3 v, boolean adjoint,
      WavelengthPacket lambda, double ru, double rv, double rj) {

    Vector3 n = x.getNormal();
    Vector3 m = microfacets.sample(ru, rv).toCartesian(x.getBasis());
    double mdoti = Math.abs(m.dot(v));
    double ndoti = Math.abs(n.dot(v));
    double mdotn = Math.abs(m.dot(n));

    double ni = -v.dot(n) >= 0.0 ? n1 : n2;
    double nt = -v.dot(n) >= 0.0 ? n2 : n1;
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.