Package ca.eandb.jmist.math

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


  public void illuminate(SurfacePoint x, WavelengthPacket lambda, Random rng, Illuminable target) {

    Vector3    lightIn      = x.getPosition().vectorTo(this.position);
    double    dSquared    = lightIn.squaredLength();

    lightIn = lightIn.divide(Math.sqrt(dSquared));

    double    ndotl      = x.getShadingNormal().dot(lightIn);
    double    attenuation    = Math.abs(ndotl) / (4.0 * Math.PI * dSquared);

    target.addLightSample(new PointLightSample(x, position, emittedPower.sample(lambda).times(attenuation), shadows));
View Full Code Here


      Vector3 v = new Vector3(
          Math.sin(theta),
          (0.5 - p.y()) * height,
          -Math.cos(theta));
      double r = v.length();
      Ray3 ray = new Ray3(Point3.ORIGIN, v.divide(r));
      Color color = getWhite();
      double pdf = (r * r * r * r) / (hfov * height);
      return ScatteredRay.diffuse(ray, color, pdf);
    }

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.