Package ca.eandb.jmist.math

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


    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;

    double r = Optics.reflectance(v, n1, n2, m.dot(n) > 0.0 ? m : m.opposite());
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

    Vector3    dir        = ray.direction().unit();
    double    sqRadius1    = major * major;
    double    sqRadius2    = minor * minor;
    double    s2NormOfDir    = dir.squaredLength();
    double    s2NormOfOrig  = orig.squaredLength();
    double    dirDotOrig    = dir.dot(orig);
    double    K        = s2NormOfOrig - (sqRadius1 + sqRadius2);

    Polynomial  f = new Polynomial(
              K * K - 4.0 * sqRadius1 * (sqRadius2 - orig.y() * orig.y()),
              4.0 * dirDotOrig * (s2NormOfOrig - (sqRadius1 + sqRadius2)) + 8.0 * sqRadius1 * dir.y() * orig.y(),
 
View Full Code Here

      do {
        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

        Point3 p = context.getPosition();
        Material mat = context.getMaterial();
        Vector3 v = x.getPosition().unitVectorFrom(p);
        Vector3 n = context.getShadingNormal();
        double d2 = x.getPosition().squaredDistanceTo(p);
        double atten = Math.max(n.dot(v), 0.0) * totalWeight / (4.0 * Math.PI * d2);
        Color ri = mat.emission(context, v, lambda).times(atten);
        LightSample sample = new PointLightSample(x, p, ri);

        target.addLightSample(sample);
      }
View Full Code Here

    Basis3 basis = x.getBasis();
    Vector3 r = x.getPosition().vectorFrom(this.boundingSphere.center());

    return new Point2(
        0.5 * (1.0 + r.dot(basis.u()) / this.boundingSphere.radius()),
        0.5 * (1.0 + r.dot(basis.v()) / this.boundingSphere.radius())
    );

  }

View Full Code Here

    Basis3 basis = x.getBasis();
    Vector3 r = x.getPosition().vectorFrom(this.boundingSphere.center());

    return new Point2(
        0.5 * (1.0 + r.dot(basis.u()) / this.boundingSphere.radius()),
        0.5 * (1.0 + r.dot(basis.v()) / this.boundingSphere.radius())
    );

  }

  /* (non-Javadoc)
 
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.