Skip to content

Wip/leaflux combined - #52

Merged
allisonrenie merged 3 commits into
mainfrom
wip/leaflux-combined
Aug 21, 2026
Merged

Wip/leaflux combined#52
allisonrenie merged 3 commits into
mainfrom
wip/leaflux-combined

Conversation

@allisonrenie

Copy link
Copy Markdown
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
@allisonrenie
allisonrenie merged commit 754bcaf into main Aug 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants