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 292, Sun Aug 15 18:43:16 2010 UTC revision 293, Sun Aug 15 18:43:42 2010 UTC
# Line 222  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 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;    double nxd, nyd, nzd, fx, fy, fz;
226      int nx, ny, nz;
227
228      fx = modf (x[0], &nxd); nx = (int)nxd;
229      fy = modf (x[1], &nyd); ny = (int)nyd;
230      fz = modf (x[2], &nzd); nz = (int)nzd;
231
232    // compute kernel values for each axis    // compute kernel values for each axis
233    double hx[4], hy[4], hz[4];    double hx[4], hy[4], hz[4];
234    for (i = 1-s;  i <= s;  i++) {    for (int i = 1-s;  i <= s;  i++) {
235      double t;      double t;
236      t = fx - i;      t = fx - i;
237      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 236  Line 241
241      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]));
242    }    }
243
244    double vv = 0.0;    float vx = 0.0;
245    for (i = 1-s;  i <= s;  i++) {    for (int i = 1-s;  i <= s;  i++) {
246      for (j = 1-s;  j <= s;  j++) {      float vy = 0.0;
247        for (k = 1-s;  k <= s;  k++) {      for (int j = 1-s;  j <= s;  j++) {
248          vv += V[nx+i][ny+j][nz+k]*hz[k+s-1]*hy[j+s-1]*hx[i+s-1];        float vz = 0.0;
249          for (int k = 1-s;  k <= s;  k++) {
250            vz += V[nx+i][ny+j][nz+k] * hz[k+s-1];
251        }        }
252          vy += vz * hy[j+s-1];
253      }      }
254        vx += vy * hx[i+s-1];
255    }    }
256
257    return vv;    return vx;
258  }  }
259  \end{lstlisting}%  \end{lstlisting}%
260  \end{quote}%  \end{quote}%
# Line 264  Line 273
273  double probe (double4 p)  double probe (double4 p)
274  {  {
275    double4 x = transform(p);     // image-space position    double4 x = transform(p);     // image-space position
276    double4 n, f    double4 nd, f
277      int4 n;
278
279    f = modf (x, &n);    f = modf (x, &nd);
280      n = convert_int4(nd);
281
282    // compute kernel values for each axis    // compute kernel values for each axis
283    double4 t, hx, hy, hz;    double4 t, hx, hy, hz;
# Line 281  Line 292
292    for (int i = 1-s;  i <= s;  i++) {    for (int i = 1-s;  i <= s;  i++) {
293      for (int j = 1-s;  j <= s;  j++) {      for (int j = 1-s;  j <= s;  j++) {
294        double4 v = (double4) (        double4 v = (double4) (
295            V[nx+i][ny+j][nz-1],            V[n.x+i][n.y+j][n.z-1],
296            V[nx+i][ny+j][nz],            V[n.x+i][n.y+j][n.z],
297            V[nx+i][ny+j][nz+1],            V[n.x+i][n.y+j][n.z+1],
298            V[nx+i][ny+j][nz+2]);            V[n.x+i][n.y+j][n.z+2]);
299        vz[j+s-1] += dot(v, hz);        vz[j+s-1] += dot(v, hz);
300      }      }
301      vy[i+s-1] = dot((double4)(vz[0], vz[1], vz[2], vz[3]), hy);      vy[i+s-1] = dot((double4)(vz[0], vz[1], vz[2], vz[3]), hy);

Legend:
 Removed from v.292 changed lines Added in v.293