Package ca.eandb.jmist.math

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


      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();
    }
  }

  public static boolean visibility(PathNode a, PathNode b) {
View Full Code Here


    if (g <= 0.0) {
      return null;
    }

    Color etol = a.scatter(v);
    Color ltoe = b.scatter(v.opposite());
    Color c = etol.times(ltoe);

    if (ColorUtil.getTotalChannelValue(c) > 0.0
        && PathUtil.visibility(a, b)) {
View Full Code Here

    Intersection  x = super.newIntersection(ray, t, ndotv < 0.0, surfaceId)
                .setLocation(p)
                .setUV(inversion)
                .setBasis((surfaceId == POLYGON_SURFACE_TOP) ? this.basis : this.basis.opposite())
                .setNormal((surfaceId == POLYGON_SURFACE_TOP) ? N : N.opposite());

    recorder.record(x);

  }
View Full Code Here

              result.cast[sensor]++;
              sensor0[0] = sensor;
            }
          });
        } while (sensor0[0] < 0);
        in = incidentPointsOutward ? in.opposite() : in;

        double wavelength = info.channel.sample(rng);
        Vector3 v = info.specimen.scatter(SurfacePointGeometry.STANDARD, in, adjoint, wavelength, rng);

        if (v != null) {
View Full Code Here

    boolean reflect = RandomUtil.bernoulli(reflectance, ref);
    Vector3 r = RandomUtil.diffuse(ref.seed, rv).toCartesian(x.getBasis());
    double pdf = 1.0 / Math.PI;

    if (!reflect) {
      r = r.opposite();
      pdf *= (1.0 - reflectance);
    } else {
      pdf *= reflectance;
    }

View Full Code Here

    double ndoti = -n.dot(in);
    double ndoto = n.dot(out);

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

    double g = microfacets.getShadowingAndMasking(in, out, hr, n);
    double d = microfacets.getDistributionPDF(hr, n);
    double f = Optics.reflectance(in, n1, n2, hr);

View Full Code Here

      no = n1;
    }

    /* Eq. (16) */
    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 ndoto = n.dot(out);

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

        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

    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;

    double r = Optics.reflectance(v, n1, n2, m.dot(n) > 0.0 ? m : m.opposite());
    boolean reflected = RandomUtil.bernoulli(r, rj);
    Vector3 out = reflected ? Optics.reflect(v, m) : Optics.refract(v, n1, n2, m);

    double g = microfacets.getShadowingAndMasking(v, out, m, n);
    double weight = (mdoti / (ndoti * mdotn)) * g;
 
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.