Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.Basis3


      specularity = fromSide ? n12 : n21;
      w = Optics.refract(v, n1, n2, N);
    }

    if (!Double.isInfinite(specularity)) {
      Basis3 basis = Basis3.fromW(w);
      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);
View Full Code Here


    /* (non-Javadoc)
     * @see ca.eandb.jmist.framework.SurfacePoint#shadingBasis()
     */
    public Basis3 getShadingBasis() {
      if (this.shadingBasis == null) {
        Basis3 basis = this.geometry.getShadingBasis(this);
        if (basis == null) {
          basis = getBasis();
        }
        this.setShadingBasis(basis);
      }
View Full Code Here

   * @see ca.eandb.jmist.framework.AbstractGeometry#getTextureCoordinates(ca.eandb.jmist.framework.AbstractGeometry.GeometryIntersection)
   */
  @Override
  protected Point2 getTextureCoordinates(GeometryIntersection x) {

    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

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.Bounded3#boundingBox()
   */
  public Box3 boundingBox() {

    Basis3 basis = Basis3.fromW(this.plane.normal(), Basis3.Orientation.RIGHT_HANDED);
    Vector3 u = basis.u();
    Vector3 v = basis.v();

    double r = this.boundingSphere.radius();
    double ri = r * Math.hypot(u.x(), v.x());
    double rj = r * Math.hypot(u.y(), v.y());
    double rk = r * Math.hypot(u.z(), v.z());
View Full Code Here

   * @see ca.eandb.jmist.framework.geometry.PrimitiveGeometry#generateRandomSurfacePoint(ca.eandb.jmist.framework.ShadingContext)
   */
  @Override
  public void generateRandomSurfacePoint(ShadingContext context, double ru, double rv, double rj) {
    Vector2 uv = RandomUtil.uniformOnDisc(boundingSphere.radius(), ru, rv).toCartesian();
    Basis3 basis = Basis3.fromW(this.plane.normal(), Basis3.Orientation.RIGHT_HANDED);

    Point3 p = boundingSphere.center()
        .plus(basis.u().times(uv.x()))
        .plus(basis.v().times(uv.y()));

    int id = (twoSided && RandomUtil.coin(rj))
        ? DISC_SURFACE_BOTTOM
        : DISC_SURFACE_TOP;

View Full Code Here

      specularity = fromSide ? n12 : n21;
      w = Optics.refract(v, n1, n2, N);
    }

    if (!Double.isInfinite(specularity)) {
      Basis3 basis = Basis3.fromW(w);
      do {
        SphericalCoordinates perturb = new SphericalCoordinates(
            Math.acos(Math.pow(1.0 - rnd.next(),
                1.0 / (specularity + 1.0))), 2.0 * Math.PI
                * rnd.next());
 
View Full Code Here

      specularity = fromSide ? n12 : n21;
      w = Optics.refract(v, n1, n2, N);
    }

    if (!Double.isInfinite(specularity)) {
      Basis3 basis = Basis3.fromW(w);
      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);
View Full Code Here

TOP

Related Classes of ca.eandb.jmist.math.Basis3

Copyright © 2018 www.massapicom. 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.