Processing Range-Sum Queries Within Triangular Shapes
摘要
Prefix sums represent a technique for precomputing partial sums to enable efficient range-sum queries. The concept is encountered under various names across disciplines: for example, summed-area tables in computer graphics, integral images in computer vision, and cumulative distribution functions in probability theory. This paper extends the use of prefix sums to triangular areas, proposing three algorithms tailored for isosceles right triangles with legs parallel to the coordinate axes. The first algorithm uses a straightforward summation of triangle rows, the second employs a recursive subdivision algorithm, while the third leverages elementary geometry principles.