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

SCM Repository

[diderot] Diff of /trunk/doc/probe/paper.tex
ViewVC logotype

Diff of /trunk/doc/probe/paper.tex

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

revision 288, Fri Aug 13 22:25:53 2010 UTC revision 289, Sat Aug 14 18:50:32 2010 UTC
# Line 46  Line 46 
46    
47  \title{Compiling probe operations for Diderot}  \title{Compiling probe operations for Diderot}
48  \author{  \author{
49   John Reppy \\   John Reppy, Gordon Kindlmann \\
50    University of Chicago \\    University of Chicago \\
51    {\small\tt{}jhr@cs.uchicago.edu} \\    {\small\tt{}\{jhr|glk\}@cs.uchicago.edu} \\
52  }  }
53  \date{\today}  \date{\today}
54    
# Line 118  Line 118 
118  \lstset{language=C}  \lstset{language=C}
119  \begin{lstlisting}  \begin{lstlisting}
120  double V[];                     // image data  double V[];                     // image data
121  double h[4][4] = {              // bspln3  double h[4][4] = {              // cubic B-spline ("bspln3")
122          { 1.33333,   2.0,  1.0,  0.166667 },   // -2 .. -1          { 1.33333,   2.0,  1.0,  0.166667 },   // -2 .. -1
123          { 0.666667,  0.0, -1.0, -0.5 },        // -1 .. 0          { 0.666667,  0.0, -1.0, -0.5 },        // -1 .. 0
124          { 0.666667,  0.0, -1.0,  0.5 },        //  0 .. 1          { 0.666667,  0.0, -1.0,  0.5 },        //  0 .. 1
# Line 127  Line 127 
127    
128  double probe (double p)  double probe (double p)
129  {  {
130    double x = transform(p);      // image-space position    double x = transform(p);      // from world- to image-space position
131    double n, f;    double nd, f; int n;
132    
133    f = modf (x, &n);    f = modf (x, &nd);
134      n = (int)nd;
135    
136    double value = 0.0, t;    double value = 0.0, t;
137    
# Line 221  Line 222 
222  double probe (vec3 p)  double probe (vec3 p)
223  {  {
224    double x[3] = transform(p);   // image-space position    double x[3] = transform(p);   // image-space position
225    double nx, ny, nz, fx, fy, fz;    double nxd, nyd, nzd, fx, fy, fz;  int nx, ny, nz, i, j, k;  fx = modf (x[0], &nxd); nx = (int)nxd;  fy = modf (x[1], &nyd); ny = (int)nyd;  fz = modf (x[2], &nzd); nz = (int)nzd;
   
   fx = modf (x[0], &nx);  
   fy = modf (x[1], &ny);  
   fz = modf (x[2], &nz);  
226    
227    // compute kernel values for each axis    // compute kernel values for each axis
228    double hx[4], hy[4], hz[4];    double hx[4], hy[4], hz[4];
229    for (int i = 1-s;  i < s;  i++) {    for (i = 1-s;  i <= s;  i++) {
230      double t;      double t;
231      t = fx - i;      t = fx - i;
232      hx[i+s-1] = h[s-i][0] + t*(h[s-i][1] + t*(h[s-i][2] + t*h[s-i][3]));      hx[i+s-1] = h[s-i][0] + t*(h[s-i][1] + t*(h[s-i][2] + t*h[s-i][3]));
# Line 239  Line 236 
236      hz[i+s-1] = h[s-i][0] + t*(h[s-i][1] + t*(h[s-i][2] + t*h[s-i][3]));      hz[i+s-1] = h[s-i][0] + t*(h[s-i][1] + t*(h[s-i][2] + t*h[s-i][3]));
237    }    }
238    
239    double vx = 0.0;    double vv = 0.0;
240    for (int i = 1-s;  i <= s;  i++) {    for (i = 1-s;  i <= s;  i++) {
241      double vy = 0.0;      for (j = 1-s;  j <= s;  j++) {
242      for (int j = 1-s;  j <= s;  j++) {        for (k = 1-s;  k <= s;  k++) {
243        double vz = 0.0;          vv += V[nx+i][ny+j][nz+k]*hz[k+s-1]*hy[j+s-1]*hx[i+s-1];
       for (int k = 1-s;  k <= s;  k++) {  
         vz += V[nx+i][ny+j][nz+k] * hz[k+s-1];  
244        }        }
       vy += vz * hy[j+s-1];  
245      }      }
     vx += vx * hx[i+s-1];  
246    }    }
247    
248    return vx;    return vv;
249  }  }
250  \end{lstlisting}%  \end{lstlisting}%
251  \end{quote}%  \end{quote}%

Legend:
Removed from v.288  
changed lines
  Added in v.289

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