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.
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.
Testing: