Examples of toCartesian()


Examples of ca.eandb.jmist.math.SphericalCoordinates.toCartesian()

      do {
        SphericalCoordinates sc = new SphericalCoordinates(
            Math.atan(alpha * Math.sqrt(-Math.log(1.0 - ru))),
            2.0 * Math.PI * rv);

        Vector3 h = sc.toCartesian(basis);
        out = Optics.reflect(v, h);
      } while (n.dot(out) <= 0.0);

    }

View Full Code Here

Examples of ca.eandb.jmist.math.SphericalCoordinates.toCartesian()

    public ScatteredRay sample(double ru, double rv, double rj) {
      Point2 p = pointOnImagePlane;
      SphericalCoordinates v = new SphericalCoordinates(
          Math.acos(1.0 - 2.0 * p.y()),
          2.0 * Math.PI * p.x());
      Ray3 ray = new Ray3(Point3.ORIGIN, v.toCartesian(BASIS));
      Color color = getWhite();
      double pdf = 1.0 / (4.0 * Math.PI);

      return ScatteredRay.diffuse(ray, color, pdf);
    }
View Full Code Here

Examples of ca.eandb.jmist.math.SphericalCoordinates.toCartesian()

  public ScatteredRay emit(SurfacePoint x, WavelengthPacket lambda, double ru, double rv, double rj) {

    if (this.emittance != null) {

      SphericalCoordinates out = RandomUtil.diffuse(ru, rv);
      Ray3 ray = new Ray3(x.getPosition(), out.toCartesian(x.getShadingBasis()));

      if (x.getNormal().dot(ray.direction()) > 0.0) {
        return ScatteredRay.diffuse(ray, emittance.getColor(x, lambda), 1.0 / Math.PI);
      }
View Full Code Here

Examples of ca.eandb.jmist.math.SphericalCoordinates.toCartesian()

      SphericalCoordinates out = RandomUtil.diffuse(ru, rv);
      if (!fromFront) {
        out = out.opposite();
      }

      Ray3 ray = new Ray3(x.getPosition(), out.toCartesian(x.getShadingBasis()));
      boolean toFront = ray.direction().dot(x.getNormal()) > 0.0;

      if (fromFront == toFront) {
        return ScatteredRay.diffuse(ray, reflectance.getColor(x, lambda), 1.0 / Math.PI);
      }
View Full Code Here

Examples of ca.eandb.jmist.math.SphericalCoordinates.toCartesian()

      double sigma4 = sigma2 * sigma2;
      Vector3 out;
      double theta = Math.acos(Math.sqrt(((sigma2 / Math.sqrt(sigma4 + (1.0 - sigma4) * ru)) - 1.0) / (sigma2 - 1.0)));
      double phi = 2.0 * Math.PI * rv;
      SphericalCoordinates sc = new SphericalCoordinates(theta, phi);
      Vector3 microN = sc.toCartesian(basis);
      out = Optics.reflect(v, microN);
      if (out.dot(N) <= 0.0) {
        return null;
      }
      return ScatteredRay.diffuse(new Ray3(x.getPosition(), out), lambda.getColorModel().getWhite(lambda), 1.0);
View Full Code Here

Examples of ca.eandb.jmist.math.SphericalCoordinates.toCartesian()

    do {
      int j = (int) Math.floor(rnd.next() * (double) lut.length);
      double theta = lut[j];
      double phi = 2.0 * Math.PI * rnd.next();
      SphericalCoordinates sc = new SphericalCoordinates(theta, phi);
      v = sc.toCartesian(basis);
      outDir = (v.dot(N) < 0.0);
    } while (inDir != outDir);

    return ScatteredRay.diffuse(new Ray3(x.getPosition(), v), lambda.getColorModel().getWhite(lambda), 1.0);
  }
View Full Code Here

Examples of ca.eandb.jmist.math.SphericalCoordinates.toCartesian()

      double theta = (lut1 != null)
          ? MathUtil.interpolate(lut0[j], lut1[j], t)
          : lut0[j];
      double phi = 2.0 * Math.PI * rnd.next();
      SphericalCoordinates sc = new SphericalCoordinates(theta, phi);
      v = sc.toCartesian(basis);
      outDir = (v.dot(N) < 0.0);
    } while (inDir != outDir);

    return v;
  }
View Full Code Here

Examples of ca.eandb.jmist.math.SphericalCoordinates.toCartesian()

      double sigma4 = sigma2 * sigma2;
      Vector3 out;
      double theta = Math.acos(Math.sqrt(((sigma2 / Math.sqrt(sigma4 + (1.0 - sigma4) * rnd.next())) - 1.0) / (sigma2 - 1.0)));
      double phi = 2.0 * Math.PI * rnd.next();
      SphericalCoordinates sc = new SphericalCoordinates(theta, phi);
      Vector3 microN = sc.toCartesian(basis);
      out = Optics.reflect(v, microN);
      if (out.dot(N) <= 0.0) {
        return null;
      }
      return out;
View Full Code Here

Examples of ca.eandb.jmist.math.SphericalCoordinates.toCartesian()

      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);
      } while ((w.dot(N) > 0.0) != toSide);
    }

    return w;
  }
View Full Code Here

Examples of ca.eandb.jmist.math.SphericalCoordinates.toCartesian()

    double[] center = new double[numSensors * 3];

    for (int sensor = 0; sensor < numSensors; sensor++) {

      SphericalCoordinates exitantAngle = collector.getSensorCenter(sensor);
      Vector3 v = exitantAngle.toCartesian();

      polar[sensor] = exitantAngle.polar();
      azimuthal[sensor] = exitantAngle.azimuthal();
      solidAngle[sensor] = collector.getSensorSolidAngle(sensor);
      projectedSolidAngle[sensor] = collector.getSensorProjectedSolidAngle(sensor);
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.