如何分析一个矩形是否与另一个矩形重叠 [英] how to analyze whether a rectangle is overlap another rectangle

查看:101
本文介绍了如何分析一个矩形是否与另一个矩形重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我在C#winform程序中遇到问题,如何分析一个矩形是否与另一个矩形重叠?

解决方案

Collision detection是计算机图形学中一个非常有趣的字段,特别是当您向它添加一个Response关键字(我的意思是 Collision detection and response):

用于检查碰撞:
http://www.gamedev.net/topic/185212-rectangle-collision-detection -in-c/ [ ^ ]

对于碰撞和响应,请使用以下库:
http://farseerphysics.codeplex.com/ [ ^ ]

希望对您有所帮助.


您可以使用Rectangle.Intersect(Rectangle).
请参阅 http://msdn.microsoft.com/en-us/library/system .drawing.rectangle.intersect.aspx [ ^ ]

干杯

安迪


hi I encounter a problem in C# winform program, How can I analyze whether a rectangle is overlap another rectangle

解决方案

Collision detection is a very interesting field in computer graphics specially when you add a Response keyword to it (I mean Collision detection and response) :

For checking collision :
http://www.gamedev.net/topic/185212-rectangle-collision-detection-in-c/[^]

For having collision and response use this library :
http://farseerphysics.codeplex.com/[^]

Hope it helps.


You may use Rectangle.Intersect(Rectangle).
See http://msdn.microsoft.com/en-us/library/system.drawing.rectangle.intersect.aspx[^]

Cheers

Andi


这篇关于如何分析一个矩形是否与另一个矩形重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆