Description
Create a function that takes a window of values, a matching grid of weights, and the row and column where the window's top left corner sits.
Add the values multiplied by the weights into the sum grid at that position, and the weights on their own into the weight grid at the same position. Adding, not replacing. A second window covering the same cells has to build on the first rather than wipe it out.
Fail with a clear message if the window would hang off the edge of the region.
This changes once the grids are held per tile rather than per region. A window crossing the edge of a tile is normal there, and gets split between the two tiles it covers rather than refused.
Keep this check to the edge of the region, so it can be lifted cleanly then.
Testing:
- Assert one window of all ones with weights of all ones puts ones in the sum grid inside that window and zeros everywhere else
- Assert adding the same window twice doubles both grids in that area
- Assert two overlapping windows leave the overlap holding the total of both, and the cells outside the overlap holding only one
- Assert a window placed so it would hang off the edge raises an error
Description
Create a function that takes a window of values, a matching grid of weights, and the row and column where the window's top left corner sits.
Add the values multiplied by the weights into the sum grid at that position, and the weights on their own into the weight grid at the same position. Adding, not replacing. A second window covering the same cells has to build on the first rather than wipe it out.
Fail with a clear message if the window would hang off the edge of the region.
This changes once the grids are held per tile rather than per region. A window crossing the edge of a tile is normal there, and gets split between the two tiles it covers rather than refused.
Keep this check to the edge of the region, so it can be lifted cleanly then.
Testing: