RECTSECT Function

Calculates the sector of a rectangle associated with x and y and returns an integer 0 to 4, indicating the sector.

Syntax

RECTSECT(width,height,x,y,option)

Remarks

Consider a rectangle that has a width and a height, and a point (x,y) from the center point of the rectangle. Draw diagonal lines through the corners of the rectangle to divide it into four sectors and a center point. The sectors 0 through 4 represent the center-point, right, top, left, and bottom respectively.

Rectangle drawn with diagonal lines through corners to divide it into four sectors and a center point

Example

RECTSECT(1 in, 2 in, 1 in, -7 in, 0)

Returns 4.