本文整理汇总了C#中Rectangle.IntersectionWith方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.IntersectionWith方法的具体用法?C# Rectangle.IntersectionWith怎么用?C# Rectangle.IntersectionWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rectangle
的用法示例。
在下文中一共展示了Rectangle.IntersectionWith方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EqualRectanglesIntersectionIsTheSame
public void EqualRectanglesIntersectionIsTheSame()
{
Rectangle a = new Rectangle (1, 2, 3, 4);
Rectangle b = new Rectangle (1, 2, 3, 4);
Rectangle c = a.IntersectionWith (b);
Assert.That (c, Is.EqualTo (new Rectangle (1, 2, 3, 4)));
}
示例2: EqualIntersection
public void EqualIntersection()
{
Rectangle a = new Rectangle (1, 1, 5, 5);
Rectangle b = new Rectangle (3, 3, 5, 5);
Rectangle c = a.IntersectionWith (b);
Assert.That (c, Is.EqualTo (new Rectangle (3, 3, 3, 3)));
}
示例3: BothRectanglesMustContainEachPointOfTheirIntersection
public void BothRectanglesMustContainEachPointOfTheirIntersection()
{
Rectangle a = new Rectangle (1, 1, 5, 5);
Rectangle b = new Rectangle (3, 3, 5, 5);
Rectangle c = a.IntersectionWith (b);
foreach (Point p in c) {
Assert.That (a.Contains (p), Is.True);
Assert.That (b.Contains (p), Is.True);
}
}
示例4: NonIntersectingRectanglesNotAllowed
public void NonIntersectingRectanglesNotAllowed()
{
Rectangle a = new Rectangle (0, 0, 2, 2);
Rectangle b = new Rectangle (2, 0, 2, 2);
a.IntersectionWith (b);
}
示例5: IntersectionWithParameterOrderDoesntMatter
public void IntersectionWithParameterOrderDoesntMatter()
{
Rectangle a = new Rectangle (1, 1, 5, 5);
Rectangle b = new Rectangle (3, 3, 5, 5);
Rectangle c = a.IntersectionWith (b);
Rectangle d = b.IntersectionWith (a);
Assert.That (c, Is.EqualTo (d));
}
示例6: SinglePointIntersection
public void SinglePointIntersection()
{
Rectangle a = new Rectangle (0, 0, 2, 2);
Rectangle b = new Rectangle (1, 1, 2, 2);
Rectangle c = a.IntersectionWith (b);
Assert.That (c, Is.EqualTo (new Rectangle (1, 1, 1, 1)));
}
示例7: SameStartingPointIntersectionHasSmallestDimensions
public void SameStartingPointIntersectionHasSmallestDimensions()
{
Rectangle a = new Rectangle (10, 15);
Rectangle b = new Rectangle (15, 10);
Rectangle c = a.IntersectionWith (b);
Assert.That (c, Is.EqualTo (new Rectangle (0, 0, 10, 10)));
}
示例8: RectangleInsideOfAnotherIntersection
public void RectangleInsideOfAnotherIntersection()
{
Rectangle a = new Rectangle (2, 2, 5, 5);
Rectangle b = new Rectangle (3, 3, 3, 3);
Rectangle c = a.IntersectionWith (b);
Assert.That (c, Is.EqualTo (new Rectangle (3, 3, 3, 3)));
}