# 演算法說明

## 參考文獻(網址)：

Burrough, P. A. and McDonell, R. A., 1998. Principles of Geographical Information Systems (Oxford University Press, New York), 190 pp.

## 計算公式說明：

(2) Zenith_deg = 90 – Altitude, 其中Altitude=45 (default)

(3) Zenith_rad = Zenith_deg * pi / 180.0

(4) Azimuth_math = 360.0 - Azimuth + 90, 其中Azimuth=315(default)

Note that if Azimuth_math >= 360.0, then:

(5) Azimuth_math = Azimuth_math - 360.0

(6) Azimuth_rad = Azimuth_math * pi / 180.0

(7) [dz/dx] = ((c + 2f + i) - (a + 2d + g)) / (8 * cellsize)

The rate of change in the y direction for cell 'e' is calculated with the following algorithm:

(8) [dz/dy] = ((g + 2h + i) - (a + 2b + c)) / (8 * cellsize)

The steepest downhill descent from each cell in the surface is the slope. The algorithm for calculating the slope in radians, incorporating the z-factor, is:

(9) Slope_rad = ATAN (z_factor * SQRT([dz/dx]2+ [dz/dy]2))

(10) The direction the steepest downslope direction is facing is the aspect. Aspect in radians is defined in the range of 0 to 2pi, with 0 toward east. The aspect is determined under the rules in the following algorithm:

If [dz/dx] is non-zero:
Aspect_rad = atan2 ([dz/dy], -[dz/dx])
if Aspect_rad < 0 then
Aspect_rad = 2 * pi + Aspect_rad
If [dz/dx] is zero:
if [dz/dy] > 0 then
Aspect_rad = pi / 2
else if [dz/dy] < 0 then
Aspect_rad = 2 * pi - pi / 2
else