public GetSum2 ( int x, int y, int rectangleWidth, int rectangleHeight ) : long | ||
x | int | The horizontal position of the rectangle |
y | int | The vertical position of the rectangle |
rectangleWidth | int | The rectangle's width |
rectangleHeight | int | The rectangle's height |
return | long |
public long GetSum2(int x, int y, int rectangleWidth, int rectangleHeight)
{
int a = (this.normalWidth * y) + x;
int b = (this.normalWidth * (y + rectangleHeight)) + (x + rectangleWidth);
int c = (this.normalWidth * (y + rectangleHeight)) + x;
int d = (this.normalWidth * y) + (x + rectangleWidth);
return this.squaredSum[a] + this.squaredSum[b] - this.squaredSum[c] - this.squaredSum[d];
}