public GetSumT ( 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 |
Résultat | long |
public long GetSumT(int x, int y, int rectangleWidth, int rectangleHeight)
{
int a = (this.tiltedWidth * (y + rectangleWidth)) + (x + rectangleWidth + 1);
int b = (this.tiltedWidth * (y + rectangleHeight)) + (x - rectangleHeight + 1);
int c = (this.tiltedWidth * y) + (x + 1);
int d = (this.tiltedWidth * (y + rectangleWidth + rectangleHeight)) + (x + rectangleWidth - rectangleHeight + 1);
return this.tiltedSum[a] + this.tiltedSum[b] - this.tiltedSum[c] - this.tiltedSum[d];
}