next up previous contents
Next: 5.3 Shading Up: 5 Implementation Previous: 5.1 Data   Contents

5.2 Gradient

A vector field of gradient vectors, $G[x,y,z][3]$, and their norms, $G_{norm}[x,y,z]$, is calculated from the scalar field of densities $D[x,y,z]$ that were initially read and resampled. For each array element, excepting only the ones at the boundaries, the gradient is computed using the central difference approximation :

$G[i,j,k][x] = \frac{1}{2} (D[i+1,j,k]-D[i-1,j,k])$
$G[i,j,k][y] = \frac{1}{2} (D[i,j+1,k]-D[i,j-1,k])$
$G[i,j,k][z] = \frac{1}{2} (D[i,j,k+1]-D[i,j,k-1])$



Elodie Fourquet 2005-01-18