6 #define SIGN_OF(x) ((x)>0?1:(x)=0?0:-1)
7 #define DISTANCE(x1,y1,x2,y2) (abs(x1-x2)+abs(y1-y2))
9 class CRect2
: public CRect
12 inline static int Compare(LPCRECT lpRect1
, LPCRECT lpRect2
)
14 int dLeft
= lpRect1
->left
- lpRect2
->left
;
19 int dTop
= lpRect1
->top
- lpRect2
->top
;
23 inline static bool IsIntersect(LPCRECT lpRect1
, LPCRECT lpRect2
)
26 return ::IntersectRect(r
, lpRect1
, lpRect2
) == TRUE
;
28 inline static int Area(LPCRECT lpRect
)
30 return (lpRect
->right
-lpRect
->left
)*(lpRect
->bottom
-lpRect
->top
);
34 class CPoint2
: public CPoint
37 inline static int Distance(POINT p1
, POINT p2
)
39 return abs(p1
.x
- p2
.x
) + abs(p1
.y
- p2
.y
);
41 inline static int Distance(int x1
, int y1
, int x2
, int y2
)
43 return abs(x1
-x2
) + abs(y1
-y2
);