title: Java 2D weighted data interpolation
body: <p>I'm trying to find some <strong>Java</strong> lib, code example (or a starting point) to help me figure out how can I interpolate a list of 2d points with a weight to generate a interpolation with level curves. </p>
  
  <p>Googling I figure out that there is <a href="http://www.cnblogs.com/sorex/archive/2012/08/06/2624791.html" rel="nofollow noreferrer">several algorithms available</a> to do this, and i found some <a href="http://www.innovativegis.com/basis/mapanalysis/topic28/topic28.htm" rel="nofollow noreferrer">explanations</a> with interesting content. The first algorithm that I want to try is the <strong>Inverse Distance Weighted</strong> interpolation.</p>
  
  <p>But with all this information i have some basic doubts:</p>
  
  <ul>
  <li><p>To generate one picture like the picture below, i have to do a pixel matrix (with weight), interpolate the data, group pixels together (by color range) and then join the points do draw the curves and put the reference text values like <a href="http://images.cnblogs.com/cnblogs_com/sorex/201208/201208061048401288.png" rel="nofollow noreferrer">this</a>?</p></li>
  <li><p><em>If</em> i need to do this pixel matrix, it will be very expensive for a giant interpolation, so can I do less points and use splines to join then to create the color levels?</p></li>
  </ul>
  
  <p><strong>Example data:</strong></p>
  
  <pre><code>+-------------------+
  |  X  |  Y  | WEIGHT|
  +-------------------+
  |  2  |  5  |   30  |
  |  7  |  3  |   25  |
  |  1  |  1  |   10  |
  |  5  |  6  |   45  |
  |  7  |  9  |   15  |
  +-------------------+
  </code></pre>
  
  <p><strong>Example Rules:</strong></p>
  
  <ul>
  <li>Value between 00-10: <em>Blue</em></li>
  <li>Value between 10-20: <em>Green</em></li>
  <li>Value between 20-30: <em>Yellow</em></li>
  <li>Value between 30-40: <em>Red</em></li>
  </ul>
  
  <p><strong>Example results:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/00Oqt.gif" alt="Shepard interpolation example"></p>
  
  <p><em>The example data, rules and results are not compatible, are just random examples to explain my prblem.</em></p>
  
  <hr>
  
  <p>Here is my final test class: <a href="http://pastebin.com/nD6MT8eS" rel="nofollow noreferrer">http://pastebin.com/nD6MT8eS</a></p>