code: public static WritableRaster calculateFactor( int h, int w, double[] sunVector, double[] inverseSunVector,
              double[] normalSunVector, WritableRaster demWR, double dx ) {
  
          double casx = 1e6 * sunVector[0];
          double casy = 1e6 * sunVector[1];
          int f_i = 0;
          int f_j = 0;
  
          if (casx <= 0) {
              f_i = 0;
          } else {
              f_i = w - 1;
          }
  
          if (casy <= 0) {
              f_j = 0;
          } else {
              f_j = h - 1;
          }
  
          WritableRaster sOmbraWR = CoverageUtilities.createWritableRaster(w, h, null, null, 1.0);
          int j = f_j;
          for( int i = 0; i < sOmbraWR.getWidth(); i++ ) {
              shadow(i, j, sOmbraWR, demWR, dx, normalSunVector, inverseSunVector);
          }
          int i = f_i;
          for( int k = 0; k < sOmbraWR.getHeight(); k++ ) {
              shadow(i, k, sOmbraWR, demWR, dx, normalSunVector, inverseSunVector);
          }
          return sOmbraWR;
      }
docs: Evaluate the shadow map calling the shadow method.
  
  @param h
  the height of the raster.
  @param w
  the width of the raster.
  @param sunVector
  @param inverseSunVector
  @param normalSunVector
  @param demWR
  the elevation map.
  @param dx
  the resolution of the elevation map.
  @return the shadow map.