code: public static double[] calculateDirectionFactor( double dx, double dy ) {
          // direction factor, where the components are 1/length
          double[] fact = new double[9];
          for( int k = 1; k <= 8; k++ ) {
              fact[k] = 1.0 / (Math.sqrt(DIR[k][0] * dy * DIR[k][0] * dy + DIR[k][1] * DIR[k][1] * dx * dx));
          }
          return fact;
      }
docs: Calculate the drainage direction factor (is used in some horton machine like pitfiller,
  flow,...)
  <p>
  Is the distance betwen the central pixel, in a 3x3 kernel, and the neighboured pixels.
  
  @param dx is the resolution of a raster map in the x direction.
  @param dy is the resolution of the raster map in the y direction.
  @return <b>fact</b> the direction factor or 1/lenght where lenght is the distance of the
  pixel from the central poxel.