(azimuth, elev, z)
| 1109 | """ |
| 1110 | |
| 1111 | def alternative_hillshade(azimuth, elev, z): |
| 1112 | illum = _sph2cart(*_azimuth2math(azimuth, elev)) |
| 1113 | illum = np.array(illum) |
| 1114 | |
| 1115 | dy, dx = np.gradient(-z) |
| 1116 | dy = -dy |
| 1117 | dz = np.ones_like(dy) |
| 1118 | normals = np.dstack([dx, dy, dz]) |
| 1119 | normals /= np.linalg.norm(normals, axis=2)[..., None] |
| 1120 | |
| 1121 | intensity = np.tensordot(normals, illum, axes=(2, 0)) |
| 1122 | intensity -= intensity.min() |
| 1123 | intensity /= np.ptp(intensity) |
| 1124 | return intensity |
| 1125 | |
| 1126 | y, x = np.mgrid[5:0:-1, :5] |
| 1127 | z = -np.hypot(x - x.mean(), y - y.mean()) |
no test coverage detected
searching dependent graphs…