Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
isInRect 宏,判断点是否在矩形内 - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


// 判断点是否位于矩形内
#define isInRect(x, y, rct) (x >= rct.left && x <= rct.right && y >= rct.top && y <= rct.bottom)

或函数

// 判断点是否位于矩形内
bool isInRect(int x, int y, RECT rct)
{
    if (rct.left > rct.right)    std::swap(rct.left, rct.right);
    if (rct.top > rct.bottom)    std::swap(rct.top, rct.bottom);
    return x >= rct.left && x <= rct.right && y >= rct.top && y <= rct.bottom;
}




返回首页


Copyright (C) 2018-2024 huidong