11 #define rect_zero {{0,0},{0,0}}
13 #define width_from_rect(RECT_PTR) ((RECT_PTR)->bottomright.x + 1 - (RECT_PTR)->topleft.x)
14 #define height_from_rect(RECT_PTR) ((RECT_PTR)->bottomright.y + 1 - (RECT_PTR)->topleft.y)
15 #define make_rect(RECT_PTR, X1, Y1, X2, Y2) do { (RECT_PTR)->topleft.x = X1; (RECT_PTR)->topleft.y = Y1; \
16 (RECT_PTR)->bottomright.x = X2; (RECT_PTR)->bottomright.y = Y2; } while(0)
17 #define point_in_rect(POINT_PTR, RECT_PTR) ((POINT_PTR)->x >= (RECT_PTR)->topleft.x && \
18 (POINT_PTR)->x <= (RECT_PTR)->bottomright.x && \
19 (POINT_PTR)->y >= (RECT_PTR)->topleft.y && \
20 (POINT_PTR)->y <= (RECT_PTR)->bottomright.y )
21 #define point_member_in_rect(POINT_PTR, RECT_PTR, IS_X) (\
23 (POINT_PTR)->x >= (RECT_PTR)->topleft.x && \
24 (POINT_PTR)->x <= (RECT_PTR)->bottomright.x \
26 (POINT_PTR)->y >= (RECT_PTR)->topleft.y && \
27 (POINT_PTR)->y <= (RECT_PTR)->bottomright.y \