title: Gaussian Blur of 3D Data
body: <p>I have a program in which I am querying all points included in a sphere S of radius R. The points are 3D points actually aligned on the vertices of a 3D regular grid, but I don't think this detail is relevant to the question. The center of the lookup volume (the sphere) can be anywhere in 3D pace.</p>
  
  <p>The points hold some data (say a real). My question, is how can I interpolate/filter the data held by the points which are included in the sphere using a 3D filter (such as gaussian filter for instance). My understanding is that you need to do something like this (pseudo code):</p>
  
  <pre><code>interp_data = 0; 
  for (each point contained in the lookup sphere S of radius R)
        // compute square distance from point location to sphere centre
        dist2 = distance2(sphere_center, curr_point_loc);
        // compute gaussian weight
        w = exp(-100 * dist2);
        sumWeight += w;
        interp_data += curr_point_data * w;
   interp_data /= sumWeight;
  </code></pre>
  
  <p>Is it correct. I have seen some code using a similar technique. I understand the value 100 on the exp function relates somehow to what seems to be called the standard normal deviation. The value 100 was hard coded in the source code that I have seen, but I assume this should somehow relate to the radius of the sphere? As the weight of the gaussian filter is supposed to drop to 0 when dist2 = R^2.</p>
  
  <p>If someone could shed some light on this it would be great.</p>
  
  <p>Also is it actually the best way of filtering 3D data? Is there a better/faster/more reliable method?</p>
  
  <p>Thanks a lot for your help.</p>