Package ca.eandb.jmist.framework

Examples of ca.eandb.jmist.framework.Random


  }

  public void castPhotons(long n, ProgressMonitor monitor, long progressInterval) {

    long untilCallback = 0;
    Random rng = new SimpleRandom();

    for (int i = 0; i < n; i++) {

      if (--untilCallback <= 0) {
View Full Code Here


  }

  public void castPhotons(long n, ProgressMonitor monitor, long progressInterval) {

    long untilCallback = 0;
    Random rng = new SimpleRandom();
    int sqrt = (int) Math.floor(Math.sqrt(n));
    int nbox = sqrt * sqrt;

    for (int i = 0; i < n; i++) {

      if (--untilCallback <= 0) {

        double progress = (double) i / (double) n;

        if (!monitor.notifyProgress(progress)) {
          monitor.notifyCancelled();
          return;
        }

        untilCallback = progressInterval;

      }

      double ru = rng.next();
      double rv = rng.next();
      double rj = rng.next();

      if (i < nbox) {
        ru = (((double) (i % sqrt)) + ru) / (double) sqrt;
        rv = (((double) (i / sqrt)) + rv) / (double) sqrt;
      }
View Full Code Here

   * @see ca.eandb.jmist.framework.Shader#shade(ca.eandb.jmist.framework.ShadingContext)
   */
  public Color shade(ShadingContext sc) {

    if (firstBounceRays > 0 && sc.getPathDepth() < 1) {
      Random sampler = firstBounceSampler.get();
      WavelengthPacket lambda = sc.getWavelengthPacket();
      Color shade = sc.getColorModel().getBlack(lambda);
      for (int i = 0; i < firstBounceRays; i++) {
        ScatteredRay ray = sc.getMaterial().scatter(sc, sc.getIncident(), true, sc.getWavelengthPacket(), sampler.next(), sampler.next(), sampler.next());
        if (ray != null) {
          shade = shade.plus(sc.castRay(ray).times(ray.getColor()));
        }
      }
      return shade.divide(firstBounceRays);
View Full Code Here

     * @see ca.eandb.jmist.framework.TaskWorker#performTask(java.lang.Object, ca.eandb.util.progress.ProgressMonitor)
     */
    public Object performTask(Object task, ProgressMonitor monitor) {

      Task        info      = (Task) task;
      Random        rng        = new SimpleRandom();
      final int      numInSensors  = incidentCollector.sensors();
      final int      numOutSensors  = exitantCollector.sensors();
      final TaskResult  result      = new TaskResult(numInSensors, numOutSensors);
      final long      progInterval  = MathUtil.clamp(info.samples / 1000, 1, 1000);
      long        progCountdown  = 1;
View Full Code Here

    public long initialRandomSeed;
    public int numPathSeeds;
  };

  private final Path generatePath(long seed) {
    Random rnd = new RandomAdapter(new java.util.Random(seed));
    Color sample = colorModel.sample(rnd);
    WavelengthPacket lambda = sample.getWavelengthPacket();
    PathNode lightTail = generateLightPath(rnd, lambda);
    PathNode eyeTail = generateEyePath(rnd, lambda);
View Full Code Here

TOP

Related Classes of ca.eandb.jmist.framework.Random

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.