Package ca.eandb.jmist.math

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


  @Override
  public Color bsdf(SurfacePoint x, Vector3 in, Vector3 out, WavelengthPacket lambda) {

    Vector3 n = x.getNormal();
    boolean fromFront = (n.dot(in) < 0.0);
    boolean toFront = (n.dot(out) > 0.0);

    Vector3 n1 = x.getShadingNormal();
    boolean fromFront1 = (n1.dot(in) < 0.0);

    if (this.reflectance != null && (toFront == fromFront) && (toFront == fromFront1)) {
View Full Code Here


    Vector3 n = x.getNormal();
    boolean fromFront = (n.dot(in) < 0.0);
    boolean toFront = (n.dot(out) > 0.0);

    Vector3 n1 = x.getShadingNormal();
    boolean fromFront1 = (n1.dot(in) < 0.0);

    if (this.reflectance != null && (toFront == fromFront) && (toFront == fromFront1)) {
      return reflectance.getColor(x, lambda).divide(Math.PI);
    } else {
      return lambda.getColorModel().getBlack(lambda);
View Full Code Here

    if (recorder.interval().contains(t)) {

      Point3 p = ray.pointAt(t);
      Vector3 dp = p.vectorFrom(this.center);

      double u = 0.5 + 0.5 * dp.dot(basis.u()) / ru;
      double v = 0.5 + 0.5 * dp.dot(basis.v()) / rv;

      if (MathUtil.inRangeCC(u, 0.0, 1.0) && MathUtil.inRangeCC(v, 0.0, 1.0)) {

        // If the rectangle is two sided, adjust the 2D inversion to include
View Full Code Here

      Point3 p = ray.pointAt(t);
      Vector3 dp = p.vectorFrom(this.center);

      double u = 0.5 + 0.5 * dp.dot(basis.u()) / ru;
      double v = 0.5 + 0.5 * dp.dot(basis.v()) / rv;

      if (MathUtil.inRangeCC(u, 0.0, 1.0) && MathUtil.inRangeCC(v, 0.0, 1.0)) {

        // If the rectangle is two sided, adjust the 2D inversion to include
        // the information about which side was intersected (i.e., each side
View Full Code Here

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

    Vector3  source = RandomUtil.uniformOnUpperHemisphere(rng).toCartesian(Basis3.fromW(zenith));

    if (source.dot(x.getNormal()) > 0.0) {
      double sdotn = source.dot(x.getShadingNormal());
      Color radiance = lambda.getColorModel().getContinuous(new SkyRadianceSpectrum(source)).sample(lambda);
      target.addLightSample(new DirectionalLightSample(x, source, radiance.times(sdotn), shadows));
    }

View Full Code Here

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

    Vector3  source = RandomUtil.uniformOnUpperHemisphere(rng).toCartesian(Basis3.fromW(zenith));

    if (source.dot(x.getNormal()) > 0.0) {
      double sdotn = source.dot(x.getShadingNormal());
      Color radiance = lambda.getColorModel().getContinuous(new SkyRadianceSpectrum(source)).sample(lambda);
      target.addLightSample(new DirectionalLightSample(x, source, radiance.times(sdotn), shadows));
    }

    if (daytime && sun.dot(x.getNormal()) > 0.0) {
View Full Code Here

    /* (non-Javadoc)
     * @see ca.eandb.jmist.framework.path.PathNode#getCosine(ca.eandb.jmist.math.Vector3)
     */
    public double getCosine(Vector3 v) {
      Vector3 n = context.getNormal();
      return n.dot(v);
    }

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

    /* (non-Javadoc)
     * @see ca.eandb.jmist.framework.path.PathNode#getPDF(ca.eandb.jmist.math.Vector3)
     */
    public double getPDF(Vector3 v) {
      Vector3 n = context.getNormal();
      return (n.dot(v) > 0.0) ? 1.0 / Math.PI : 0.0;
    }

  }

}
View Full Code Here

        SphericalCoordinates perturb = new SphericalCoordinates(
            Math.acos(Math.pow(1.0 - rnd.next(),
                1.0 / (specularity + 1.0))), 2.0 * Math.PI
                * rnd.next());
        w = perturb.toCartesian(basis);
      } while ((w.dot(N) > 0.0) != toSide);
    }

    return w;
  }

View Full Code Here

      do {
        SphericalCoordinates perturb = new SphericalCoordinates(
            Math.acos(Math.pow(1.0 - ru, 1.0 / (specularity + 1.0))),
            2.0 * Math.PI * rv);
        w = perturb.toCartesian(basis);
      } while ((w.dot(N) > 0.0) != toSide);
    }

    return new ScatteredRay(new Ray3(x.getPosition(), w),
        lambda.getColorModel().getWhite(lambda),
        Double.isInfinite(specularity) ? Type.SPECULAR : Type.DIFFUSE,
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.