ishu9bansal / ideone

useful pieces of codes
1 stars 1 forks source link

Scan a random shaped moving window across a 2d grid #20

Open ishu9bansal opened 2 years ago

ishu9bansal commented 2 years ago

Is there a way to scan (and sum) a random shape (say diamond, circle, etc.) over a 2D grid, and produce a grid of new values, in linear time?

ishu9bansal commented 2 years ago

https://ideone.com/oH4Ft8

preliminary code, not tested