Wip/leaflux combined - #52
Merged
Merged
Conversation
allisonrenie
commented
Aug 21, 2026
Collaborator
- Combines origin offset change and non-cubic shadow displacement fix
attenuate_all rotates grid-index coordinates so the sun points straight down, then floors onto a 1x1 lattice for the shadow sweep. Index space is only physically proportioned when the voxel is cubic, so voxel_dim was ignored in the geometry (it only fed the path-length scalar d) and shadows landed at the wrong angle for any non-cubic voxel. Scale the index coordinates by the voxel aspect ratio, normalized by the x-resolution, before rotation. Cubic voxels and voxel_dim=None normalize to (1, 1, 1) and are unchanged; an anisotropic voxel is stretched to physical proportions so the shadow angle is correct. Applied to the leaf, terrain, and sensor rotation inputs; outputs stay in index coordinates. This changes results for any non-cubic voxel_dim (previously wrong). Closes #49
The test covered aspect 1 (cubic/None) and aspect 3, but not aspect < 1 — the shipping treevox voxel is 2 m wide and 1 m tall (dz/dx = 1/2), whose shadow should reach HALF as far as the cubic case. Add a third ground sensor at that offset and assert 2x2x1 lands there. Verified the new assertion fails on the pre-fix geometry (it shadowed the cubic cell).
# Conflicts: # leaflux/general.py # test/test_general.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.