Step 3: Set i = j = 1; N0 = D0 = wi
Step 4: Set Ni = Ni-1 + 2Vi and Dj = Dj-1 + 2Hj. Increment i = i + 1 and j = j + 1
Step 5: If i < p or j < q, go to Step 4. Otherwise, set i = j = 0 and determine Sij, the slope of contour lines through the region bounded by vertical lines i and i + 1 and horizontal line j and j + 1 using the equation Sij = -Ni/Dj. Increment i = i + 1 and j = j + 1