Repository navigation
fix(render): Shaded Relief lights a bottom-up or right-to-left raster from the right side (#1798) - #1849
Conversation
… from the right side (opengeos#1798) The 3x3 window the map's hillshade reads was taken in grid order, which the hillshade treats as north up, so a raster stored bottom up was lit from the mirrored azimuth. The window now steps east and north whichever way the grid is stored, as the analysis hillshade does.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewBugs: None found. I traced the window reorientation against Security: None. No new input parsing, I/O or unsafe code. The new code is integer arithmetic on ±1 steps, and Performance: None. The per-pixel cost is two integer multiplies on a 9-entry loop. Confidence: high. Quality (nits, not inline-worthy):
These are style points and can wait for the release quality pass. AGENTS.md: Compliant. No Test verification: I did not run the tests, since this review has no execution tool. The Prior concerns: No review threads exist on this PR, so none were left alone. No inline comments were posted, since no finding warrants one. Change sizeCompared with the base branch: the whole PR against main (merge base cf61cc6 to PR head d1e613d).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
Summary
Closes #1798. The map's Shaded Relief lit a raster stored bottom up (positive pixel height, as some COGs are) from the mirrored azimuth: a slope facing south, lit from the north, came out brighter than flat ground. A raster stored right to left was mirrored east–west the same way.
Cause:
Pass1::rows(crates/render/src/raster.rs) built the 3×3 window in grid order. It then handed it torustgis_map::raster::hillshade, which takes the window's first row as north and its first column as west.Fix:
Pass1now carries the grid's direction (east_north): −1 for columns stored right to left and for rows stored bottom up. The window's offsets are multiplied by it, so the window is always read west to east and north to south. This is the same idea asanalysis::rasterops::terrain_on, which already handles it.hillshadeitself and the unsigned cell sizes are unchanged, and nothing else callshillshadewith a grid window (the DEM tiles' hillshade reads north-up web tiles).The cast shadows (#1796) follow the transform's signs already, so on a bottom-up raster the hillshade and the shadows now agree.
Testing
raster::tests::shaded_relief_follows_the_grids_orientation:cargo test -p rustgis-render -p rustgis-mappasses (render 428, map 311).cargo clippy -p rustgis-render -p rustgis-map --all-targets -- -D warningsandcargo fmt --all --checkare clean.zstd-sysneeds a clang this machine lacks).Summary by CodeRabbit