title: Moving points to a regular grid
body: <p>I need to evenly distribute clumped 3D data.  2D solutions would be terrific.  Up to many millions of data points.</p>
  
  <p>I am looking for the best method to evenly distribute [ie fully populate a correctly sized grid] clumped 3D or 2D data.<br>
  Sorting in numerous directions numerous times, with a shake to separate clumps a little now &amp; again, is the method currently used.  It is known that it is far from optimum.  In general sorting is no good because it spreads/flattens clumps of points across a single surface.<br>
  Triangulation would seemingly be best [de-warp back to a regular grid] however I could never get the proper hull and had other problems.
  Pressure equalization type methods seem over the top.<br>
  Can anybody point me in the direction of information on this?
  Thanks for your time.</p>
  
  <p>Currently used [inadequate] code 
  1 - allocates indexes for sorting in various directions [side to side, then on diagonals], 
  2 - performs the sorts independently; 
  3 - allocates 2D locations from the sorts; 
  4 - averages the locations obtained from the different sorts;
  5 - shakes [attempted side to side &amp; up/down movement of whole dataset leaving duplicates static] to declump;
  6 - repeat as required up to 11 times.  </p>
  
  <p>I presume the "best" result would be the minimum total movement from  original locations to final grided locations.</p>