Skip to content

Fix inverted decay and off-by-one in bump spread (#1102)#1103

Merged
brendancol merged 1 commit intomasterfrom
issue-1102
Mar 31, 2026
Merged

Fix inverted decay and off-by-one in bump spread (#1102)#1103
brendancol merged 1 commit intomasterfrom
issue-1102

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

Fixes #1102. _finish_bump had two bugs that affected every bump this module produces:

  1. Inverted decay: d2 / s gave more height to pixels farther from center. Changed to (s - d2) / s so adjacent pixels get the most contribution and the edge tapers to zero.

  2. Off-by-one: range(x - spread, x + spread) excluded the last pixel on the positive side because range excludes its upper bound. Changed to x + spread + 1 for both axes.

Both bugs are in _finish_bump, which all four backends share.

Test plan

  • test_bump_decay_strongest_at_center_1102: center > adjacent > far
  • test_bump_spread_reaches_both_sides_1102: pixels on both sides of center are reached, outside spread is zero
  • Full test_bump.py suite: 10 passed

_finish_bump had two bugs:
1. d2/s gave more height to farther pixels (inverted). Changed to
   (s-d2)/s so adjacent pixels get the most contribution.
2. range(x-spread, x+spread) missed the last pixel. Changed to
   x+spread+1 for both axes.
@github-actions github-actions bot added the performance PR touches performance-sensitive code label Mar 31, 2026
@brendancol brendancol merged commit 8ae9961 into master Mar 31, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bump: inverted decay formula and off-by-one in spread loop

1 participant