code: @SuppressWarnings("unchecked")
      public static void smoothIDW( List<LasRecord> lasPoints, boolean useGround, double idwBuffer, IHMProgressMonitor pm ) {
          List<Coordinate> coordinatesList = new ArrayList<Coordinate>();
          if (useGround) {
              for( LasRecord dot : lasPoints ) {
                  Coordinate c = new Coordinate(dot.x, dot.y, dot.groundElevation);
                  coordinatesList.add(c);
              }
          } else {
              for( LasRecord dot : lasPoints ) {
                  Coordinate c = new Coordinate(dot.x, dot.y, dot.z);
                  coordinatesList.add(c);
              }
          }
  
          // make triangles tree
          STRtree pointsTree = new STRtree(coordinatesList.size());
          pm.beginTask("Make points tree...", coordinatesList.size());
          for( Coordinate coord : coordinatesList ) {
              pointsTree.insert(new Envelope(coord), coord);
              pm.worked(1);
          }
          pm.done();
  
          pm.beginTask("Interpolate...", coordinatesList.size());
          for( int i = 0; i < coordinatesList.size(); i++ ) {
              Coordinate coord = coordinatesList.get(i);
              Envelope env = new Envelope(coord);
              env.expandBy(idwBuffer);
              List<Coordinate> nearPoints = pointsTree.query(env);
              double avg = 0;
              for( Coordinate coordinate : nearPoints ) {
                  avg += coordinate.z;
              }
              avg = avg / nearPoints.size();
  
              LasRecord lasRecord = lasPoints.get(i);
              if (useGround) {
                  lasRecord.groundElevation = avg;
              } else {
                  lasRecord.z = avg;
              }
              pm.worked(1);
          }
          pm.done();
      }
docs: Smooths a set of las points through the IDW method.
  
  <p>Note that the values in the original data are changed.
  
  @param lasPoints the list of points to smooth.
  @param useGround if <code>true</code>, the ground elev is smoothed instead of the z.
  @param idwBuffer the buffer around the points to consider for smoothing.
  @param pm the monitor.