Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /examples/iso2d-demo/iso2d.diderot
ViewVC logotype

Diff of /examples/iso2d-demo/iso2d.diderot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1880, Fri May 18 21:49:16 2012 UTC revision 1920, Fri Jun 8 12:11:49 2012 UTC
# Line 8  Line 8 
8  // unu jhisto -i iso2d.txt -b 512 512 -min 0 0 -max 1 1 | unu 2op neq - 0 | unu quantize -b 8  -o iso2d.png  // unu jhisto -i iso2d.txt -b 512 512 -min 0 0 -max 1 1 | unu 2op neq - 0 | unu quantize -b 8  -o iso2d.png
9    
10  int gridSize = 300;  int gridSize = 300;
11  input image(2)[] diderot = load("data/ddro-80.nrrd");  image(2)[] diderot = load("data/ddro-80.nrrd");
12  field#1(2)[] F = ctmr ⊛ diderot;  field#1(2)[] F = ctmr ⊛ diderot;
13  int stepsMax = 10;  int stepsMax = 10;
14  real epsilon = 0.0001;  real epsilon = 0.0001;
15    
16  strand sample (int ui, int vi) {  strand sample (int ui, int vi) {
17      // world is 1x1 centered at (0.5, 0.5)
18      output vec2 pos = [lerp(0.0, 1.0, -0.5, real(ui), real(gridSize)-0.5),      output vec2 pos = [lerp(0.0, 1.0, -0.5, real(ui), real(gridSize)-0.5),
19                         lerp(0.0, 1.0, -0.5, real(vi), real(gridSize)-0.5)];                         lerp(0.0, 1.0, -0.5, real(vi), real(gridSize)-0.5)];
20      // set the isvalue to 50, 30, or 10, depending on whichever we're closest to      // set the isvalue to 50, 30, or 10, depending on whichever we're closest to
# Line 26  Line 27 
27          if (!inside(pos, F) || steps > stepsMax) {          if (!inside(pos, F) || steps > stepsMax) {
28              die;              die;
29          }          }
         // GLKs recent changes (revision 1329) were made to make the code  
         // a more obvious implementation of Newton-Raphson, and also to create  
         // some obvious and not-so-obvious opportunties for optimization  
30          vec2 grad = ∇F(pos);          vec2 grad = ∇F(pos);
31          if (|grad| == 0.0) {    // can't compute step if |∇F|, so have to bail          if (|grad| == 0.0) {    // can't compute step if |∇F|, so have to bail
32              die;              die;

Legend:
Removed from v.1880  
changed lines
  Added in v.1920

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0