title: Method for finding normals to a voxel surface
body: <p>I was working on a method to approximate the normal to a surface of a 3d voxel image.</p>
  
  <p>The method suggested in <a href="http://www.ppmsite.com/sibgrapi2007/finding_surface_normals_from_voxels.pdf" rel="nofollow">this article</a> (only algorithm I found via Google) seems to work.  The suggested method from the paper is to find the direction the surface varies the most in, choose 2 points on the tangent plane using some procedure, and then take the cross product.  Some <a href="http://svn.ppmsite.com/filedetails.php?repname=OS%20Voxel%20Tools&amp;path=%2Fvxlseiii13x%2FVoxel_AutoNormals.pas&amp;rev=0&amp;sc=1" rel="nofollow">Pascal code by the article author code</a>, commented in Portuguese, implements this method.</p>
  
  <p>However, using the gradient of f (use each partial derivative as a component of the vector) as the normal seems to work pretty well; I tested this along several circles on a voxellated sphere and I got results that look correct in most spots (there are a few outliers that are off by about 30 degrees).  This is very different from the method used in the paper, but it still works.  What I don't understand is why the gradient of f = 1/dist calculated along the surface of an object should produce the normal. </p>
  
  <p>Why does this procedure work?  Is it just the fact that the sphere test was too much of a special case?  Could you suggest a simpler method, or explain any of these methods?</p>