问题描述
我读到有关interset/intersetWith的信息,
但我看不到这种方法..
即时搜索了两个小时,但我什么都没找到.
我尝试过的事情:
//我有矩形对象
矩形a = new Rectangle();
矩形b =新的Rectangle();
////然后我尝试使用相交"方法检查"a"是否碰到"b",并且没有看到他..
im read about interset /intersetWith ,
but i dont see this method ..
im search for two hours but i dont find anything..
What I have tried:
// i have rectangle object
Rectangle a = new Rectangle();
Rectangle b = new Rectangle();
// then i try to check if "a" touch "b" using Intersect method and i dont see him ..
推荐答案
将两个相交的指定Rect值的区域作为新Rect返回. C#和Microsoft Visual Basic代码应改为使用相交".
Returns the areas of two specified Rect values that intersect, as a new Rect. C# and Microsoft Visual Basic code should use Intersect instead.
im搜索了两个小时,但我什么都没找到..
im search for two hours but i dont find anything..
有时,构建自己的解决方案要花很多时间,而谷歌搜索要花几个小时.
当给您2个矩形时,使用相同逻辑的变体来查找它们是分开的,接触的,昆虫的还是重叠的都是问题.
只要看一下坐标,就可以得到2个矩形A =(1,1,2,3)和B =(5,5,6,7),您的大脑告诉您它们是分开的.
考虑一下您刚才使用的逻辑,您的程序将使用相同的逻辑.
Sometimes, it get just faster to build your own solution rather than Googling for hours.
When you are given 2 rectangles, finding if they are separated, touching, insect or overlapping are all problems using variations of the same logic.
Get 2 rectangles A=(1,1,2,3) and B=(5,5,6,7), just by looking at coordinates, your brain tell you that they are separated.
Think about the logic you just used, your program will use the same logic.
这篇关于如何知道两个矩形是否彼此接触(C#,UWP应用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!