Package ca.eandb.jmist.math

Examples of ca.eandb.jmist.math.SphericalCoordinates


  }

  public static SphericalCoordinates uniformOnUpperHemisphere(double radius, double ru, double rv) {

    // TODO implement this directly so it's more efficient.
    SphericalCoordinates result = uniformOnSphere(radius, ru, rv);

    if (result.polar() > (Math.PI / 2.0))
      result = new SphericalCoordinates(Math.PI - result.polar(), result.azimuthal(), radius);

    return result;

  }
View Full Code Here


  public static SphericalCoordinates uniformOnSphere(double radius, double ru, double rv) {

    assert(0.0 <= ru && ru <= 1.0);
    assert(0.0 <= rv && rv <= 1.0);

    return new SphericalCoordinates(
        Math.acos(2.0 * ru - 1.0),
        2.0 * Math.PI * rv,
        radius
    );

View Full Code Here

    assert(0.0 <= ru && ru <= 1.0);
    assert(0.0 <= rv && rv <= 1.0);
    assert(0.0 <= rw && rw <= 1.0);

    return new SphericalCoordinates(
        Math.acos(2.0 * ru - 1.0),
        2.0 * Math.PI * rv,
        radius * Math.cbrt(rw)
    );

View Full Code Here

    for (int specimenIndex = 0, n = 0; specimenIndex < this.specimens.length; specimenIndex++) {

      for (int incidentAngleIndex = 0; incidentAngleIndex < this.incidentAngles.length; incidentAngleIndex++) {

        SphericalCoordinates      incidentAngle      = this.incidentAngles[incidentAngleIndex];

        for (int wavelengthIndex = 0; wavelengthIndex < this.wavelengths.length; wavelengthIndex++, n++) {

          double            wavelength        = this.wavelengths[wavelengthIndex];
          IntegerSensorArray      sensorArray        = this.results[n];

          for (int sensor = 0; sensor < worker.collector.sensors(); sensor++) {

            SphericalCoordinates  exitantAngle      = worker.collector.getSensorCenter(sensor);
            double          solidAngle        = worker.collector.getSensorSolidAngle(sensor);
            double          projectedSolidAngle    = worker.collector.getSensorProjectedSolidAngle(sensor);
            long          hits          = sensorArray.hits(sensor);
            double          reflectance        = (double) hits / (double) this.samplesPerMeasurement;

            out.printf(
                "%d,%f,%f,%e,%d,%f,%f,%f,%f,%d,%d,%f,%e,%e",
                specimenIndex,
                incidentAngle.polar(),
                incidentAngle.azimuthal(),
                wavelength,
                sensor,
                exitantAngle.polar(),
                exitantAngle.azimuthal(),
                solidAngle,
                projectedSolidAngle,
                this.samplesPerMeasurement,
                hits,
                reflectance,
View Full Code Here

   * @see ca.eandb.jmist.framework.geometry.AbstractGeometry#getTextureCoordinates(ca.eandb.jmist.framework.geometry.AbstractGeometry.GeometryIntersection)
   */
  @Override
  protected Point2 getTextureCoordinates(GeometryIntersection x) {
    Vector3          n = x.getNormal();
    SphericalCoordinates  sc = SphericalCoordinates.fromCartesian(new Vector3(n.x(), -n.z(), n.y()));

    return new Point2(
        (Math.PI + sc.azimuthal()) / (2.0 * Math.PI),
        sc.polar() / Math.PI
    );
  }
View Full Code Here

    this.writeColumnHeadings(out);

    for (int incidentAngleIndex = 0, n = 0; incidentAngleIndex < this.incidentAngles.length; incidentAngleIndex++) {

      SphericalCoordinates      incidentAngle      = this.incidentAngles[incidentAngleIndex];

      for (int wavelengthIndex = 0; wavelengthIndex < this.wavelengths.length; wavelengthIndex++, n++) {

        double            wavelength        = this.wavelengths[wavelengthIndex];
        IntegerSensorArray      sensorArray        = this.results[n];

        for (int sensor = 0; sensor < worker.collector.sensors(); sensor++) {

          SphericalCoordinates  exitantAngle      = worker.collector.getSensorCenter(sensor);
          double          solidAngle        = worker.collector.getSensorSolidAngle(sensor);
          double          projectedSolidAngle    = worker.collector.getSensorProjectedSolidAngle(sensor);
          long          hits          = sensorArray.hits(sensor);
          double          reflectance        = (double) hits / (double) this.samplesPerMeasurement;

          out.printf(
              "%f,%f,%e,%d,%f,%f,%f,%f,%d,%d,%f,%e,%e",
              incidentAngle.polar(),
              incidentAngle.azimuthal(),
              wavelength,
              sensor,
              exitantAngle.polar(),
              exitantAngle.azimuthal(),
              solidAngle,
              projectedSolidAngle,
              this.samplesPerMeasurement,
              hits,
              reflectance,
View Full Code Here

    double[] projectedSolidAngle = new double[numSensors];
    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);
      center[sensor * 3 + 0] = v.x();
      center[sensor * 3 + 1] = v.y();
      center[sensor * 3 + 2] = v.z();
View Full Code Here

  /* (non-Javadoc)
   * @see ca.eandb.jmist.framework.AbstractGeometry#getTextureCoordinates(ca.eandb.jmist.framework.AbstractGeometry.GeometryIntersection)
   */
  @Override
  protected Point2 getTextureCoordinates(GeometryIntersection x) {
    SphericalCoordinates sc = SphericalCoordinates.fromCartesian(x.getPosition().vectorFromOrigin());
    return new Point2((Math.PI + sc.azimuthal()) / (2.0 * Math.PI), sc.polar() / Math.PI);
  }
View Full Code Here

    }

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

    return w;
  }
View Full Code Here

    }

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

    return new ScatteredRay(new Ray3(x.getPosition(), w),
        lambda.getColorModel().getWhite(lambda),
View Full Code Here

TOP

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

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.