惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
小众软件
小众软件
P
Proofpoint News Feed
IT之家
IT之家
Apple Machine Learning Research
Apple Machine Learning Research
T
The Exploit Database - CXSecurity.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Threat Research - Cisco Blogs
K
Kaspersky official blog
V
V2EX
博客园 - Franky
Cisco Talos Blog
Cisco Talos Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Scott Helme
Scott Helme
量子位
SecWiki News
SecWiki News
博客园 - 叶小钗
S
SegmentFault 最新的问题
L
LINUX DO - 最新话题
Attack and Defense Labs
Attack and Defense Labs
T
Tailwind CSS Blog
Google DeepMind News
Google DeepMind News
T
Tor Project blog
N
News and Events Feed by Topic
The Cloudflare Blog
Help Net Security
Help Net Security
Forbes - Security
Forbes - Security
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
P
Privacy & Cybersecurity Law Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
Arctic Wolf
L
LangChain Blog
Latest news
Latest news
S
Schneier on Security
C
CERT Recently Published Vulnerability Notes
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园_首页
T
The Blog of Author Tim Ferriss
Schneier on Security
Schneier on Security
S
Security @ Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
MyScale Blog
MyScale Blog
Blog — PlanetScale
Blog — PlanetScale
O
OpenAI News

浮生笔记

时机的重要性 回答dayu博客的几个问题 学会做选择 我理想的城市 如何选择一个适合的城市 马来西亚游记 回首2023,展望2024 从ChatGPT聊起 菲律宾旅游攻略笔记 深圳游记 香港游记 怎样赚钱----我理解的商业模式 用户界面与跨平台 使用telnet通过IMAP协议读取QQ邮箱 信息成本-----从ChatGPT到情报学 买断制到订阅制----兼谈消费频次 我眼中的CSDN 迁移博客内容到静态博客 Hugo使用Jane主题支持搜索实现 C语言和Lua的相互调用示例代码 从放逐之城看经济学 不同产业的分析 回首2021,展望2022 游戏中的经济学 Windows获取网络地址、子网掩码等 -fsanitize=address 参数作用 C++ 编译器支持标准判断 VS Code的golang开发配置 之 代码提示 二叉树遍历的非递归算法的实现 我的Chrome插件 golang 获取get参数 关于写代码的几个看法 golang编程之我见 Linux 网络编程之 Select 构建之法读书笔记 (1) 友情链接 Effective Morden C++ 读书笔记(3) 二进制协议 vs 文本协议 从重构到重写 asio制作使用ssl通信的证书 gdb 7.11 Linux 获取网卡信息 《构建之法》读后感 由买冰箱想到的 2014年年终总结 聊聊我对写好程序的认识 编程技巧之表格驱动编程 经验搜索排名---google已经做过类似的了(我想多了) 有关编程语言的认识
C++ 编译器支持标准判断
DennisThink · 2019-01-20 · via 浮生笔记
// 矩形重叠类型注释
// CORNER_OVERLAP
// --------------------
// |                  |
// |                  |
// |        **********|**********
// |        *         |         *
// |        *         |         *
// ---------*---------|         *
//          *                   *
//          *                   *
//          *********************
//  
//  ANCHOR_OVERLAP
//            ----
//            |  |
//            |  |
//     *******|**|*******
//     *	  |	 |		*
//     *      |  |      *
//     *      ----      *
//     *                *
//     ******************
//   SAME_WIDTH_OVERLAP  
//     |-----------------|
//     |                 |
//     ******************|
//     |-----------------*
//     *                 *
//     *******************
//
//     INSIDE_OVERLAP
//   **********************
//	 *                    *
//   *     ---------      *
//   *     |       |      *
//   *     |       |      *
//   *     ---------      *
//   *                    *
//   **********************   
//   
//     CROSS_OVERLAP
//          -----
//          |   |           
//          |   |
//     *****|***|******
//     *    |   |     *
//     *    |   |     *
//     *****|***|******
//          |   |  
//          -----         
typedef enum EM_RectOverlapType
{
	NO_OVERLAP,
    CORNER_OVERLAP,
	ANCHOR_OVERLAP,
	SAME_WIDTH_OVERLAP,
	INSIDE_OVERLAP,
	CROSS_OVERLAP,
	ERROR_OVERLAP,
}EM_RectOverlapType;

//判断Rect重叠的类型,判定方法
//NO_OVERLAP:     重叠矩形面积为0 
//CORNER_OVERLAP: 重叠矩形的一个角的两条边,与被判定矩形的一个角的两条边坐标一致(角的2条边)
//SAME_WIDTH_OVERLAP: 两个矩形的横向坐标或者纵向坐标一致,并且重叠。
//ANCHOR_OVERLAP: 重叠矩形的三条边与被判定矩形的三条边重叠(3个边)
//INSIDE_OVERLAP: 重叠矩形与被判定矩形的其中之一完全重合(4个边)
//CROSS_OVERLAP : 重叠矩形的平行的两条边与被判定矩形之一的对应两条边重叠,另两条边与另一个被判定矩形的对应的另两条边重叠(2对对应的两条边)
//后三种的相同部分是都有平行的两条边重合,所以判定先重后三行开始
EM_RectOverlapType JudgeOverlapTypeByTwoRect(const EM_RECT& firstRect,const EM_RECT& overlapRect)
{
	if ( (overlapRect.left == firstRect.left) && (overlapRect.right==firstRect.right))//平行2条边
	{
		if ( (overlapRect.top == firstRect.top) )//3条边
		{
			if (overlapRect.bottom == firstRect.bottom)//4条边
			{
				return INSIDE_OVERLAP;
			}
			else
			{
				return ANCHOR_OVERLAP;
			}
		}
		else if (overlapRect.bottom == firstRect.bottom)
		{
			if (overlapRect.top == firstRect.top)
			{
				return INSIDE_OVERLAP;
			}
			else
			{
				return ANCHOR_OVERLAP;
			}
		}
		else
		{
			return SAME_WIDTH_OVERLAP;
		}
	}
	else if ((overlapRect.top == firstRect.top) && (overlapRect.bottom == firstRect.bottom) )
	{
		return SAME_WIDTH_OVERLAP;
	}
	else 
	{
		return CORNER_OVERLAP;
	}
}

EM_RectOverlapType JudgeOverlapType(const EM_RECT& firstRect,const EM_RECT& secondRect,const EM_RECT& overlapRect)
{
	EM_RectOverlapType firstType = JudgeOverlapTypeByTwoRect(firstRect,overlapRect);
	if (ERROR_OVERLAP != firstType)
	{   
	    return firstType;
	}
	else
	{
		EM_RectOverlapType secondType = JudgeOverlapTypeByTwoRect(secondRect,overlapRect); 
		if (ERROR_OVERLAP != secondType)
		{
			return secondType;
		}
		else
		{
			return ERROR_OVERLAP;
		}
	}
}

EM_RectOverlapType GetRectOverlapType(const EM_RECT& firstRect,const EM_RECT& secondRect)
{
	EM_RECT overlapRect = GetOverlapRect(firstRect,secondRect);
	long overlapRectSize = GetEM_RECTSize(overlapRect);
	if (overlapRectSize)
	{
		return JudgeOverlapType(firstRect,secondRect,overlapRect);
	}
	else
	{
		return NO_OVERLAP;
	}
}

文章作者 DennisThink

上次更新 2019-01-28

许可协议 CC BY-NC-ND 4.0