As per Wikipedia:
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.
For a 2D space a summed area table can be generated by iterating x,y
over the desired range,
I(x,y) = i(x,y) + I(x-1,y) + I(x,y-1) - I(x-1,y-1)
And the query
function for a rectangle corners A(top-left)
, B(top-right)
, C(bottom-right)
, D
can be given by:-
I(C) + I(A) - I(B) - I(D)
I want to convert the above to 3D. Also please tell if any other method/data structure available for calculating partial sums in 3D space.