A summed-area table is a data structure and algorithm for quickly and efficiently generating the sum of values in a rectangular subset of a grid [Wikipedia]. Is there any algorithm for quickly and efficiently generating the sum of values in a circular subset of a grid?
1 Answers
The best way is to approximate circle with hexagon or octagon as desciribed in expired patent US 6507676 B1. Further improvement is to add rectangles to octagon to get more circular shape or like harold proposed cover the whole circle with rectangles. Unfortunately this defies the core efficiency of summed area table.
The naive way would be to use e.g. Bresenham circle algorithm and sum consecutive rectangles, which by the way is still big speed up, proportional to circle size. The best way is to inscribe square and add rectangles to get finer results. This is illustrated here.

Picture taken from http://yehar.com/
There is no possibility of creating SAT especially for circle even leaving jagged border, simple proof is from impossibility of tesselating space by circles.
- 9,525
- 11
- 32
- 53