Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

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

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

revision 300, Sun Aug 15 23:11:22 2010 UTC revision 301, Sun Aug 15 23:13:20 2010 UTC
# Line 328  Line 328
328  \begin{quote}  \begin{quote}
329  \lstset{language=C}  \lstset{language=C}
330  \begin{lstlisting}  \begin{lstlisting}
331  double probe (vec3 p)  vec3 probe (vec3 p)
332  {  {
333    double x[3] = transform(p);   // image-space position    double x[3] = transform(p);   // image-space position
334    double nx, ny, nz, fx, fy, fz;    double nxd, nyd, nzd, fx, fy, fz;
335      int nx, ny, nz;
336
337    fx = modf (x[0], &nx);    fx = modf (x[0], &nxd); nx = (int)nxd;  fy = modf (x[1], &nyd); ny = (int)nyd;  fz = modf (x[2], &nzd); nz = (int)nzd;
fy = modf (x[1], &ny);
fz = modf (x[2], &nz);
338
339    // compute kernel values for each axis    // compute kernel values for each axis
340    double hx[4], dhx[4], hy[4], dhy[4], hz[4], dhz[4];    double hx[4], dhx[4], hy[4], dhy[4], hz[4], dhz[4];
341    for (int i = 1-s;  i < s;  i++) {    for (int i = 1-s;  i <= s;  i++) {
342      double t;      double t;
343      t = fx - i;      t = fx - i;
344      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 360  Line 359
359        for (int k = 1-s;  k <= s;  k++) {        for (int k = 1-s;  k <= s;  k++) {
360          double v = V[nx+i][ny+j][nz+k];          double v = V[nx+i][ny+j][nz+k];
361          vz[0] = v * hz[k+s-1];          vz[0] = v * hz[k+s-1];
362          vz[1] = vz[0];          vz[1] = v * hz[k+s-1];
363          vz[2] = v * dhz[k+s-1];          vz[2] = v * dhz[k+s-1];
364        }        }
365        vy[0] += vz[0] * hy[j+s-1];        vy[0] += vz[0] * hy[j+s-1];
366        vy[1] += vz[1] * dhy[j+s-1];        vy[1] += vz[1] * dhy[j+s-1];
367        vy[2] += vz[2] * hy[j+s-1];        vy[2] += vz[2] * hy[j+s-1];
368      }      }
369      vx[0] += vx[0] * dhx[i+s-1];      vx[0] += vy[0] * dhx[i+s-1];
370      vx[1] += vx[1] * hx[i+s-1];      vx[1] += vy[1] * hx[i+s-1];
371      vx[2] += vx[2] * hx[i+s-1];      vx[2] += vy[2] * hx[i+s-1];
372    }    }

373    return vx;    return vx;
374  }  }
375  \end{lstlisting}%  \end{lstlisting}%

Legend:
 Removed from v.300 changed lines Added in v.301