本文整理汇总了C#中Interval.Intersects方法的典型用法代码示例。如果您正苦于以下问题:C# Interval.Intersects方法的具体用法?C# Interval.Intersects怎么用?C# Interval.Intersects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interval
的用法示例。
在下文中一共展示了Interval.Intersects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IntersectsTest
public void IntersectsTest()
{
var A = new Interval(0.0f, 5.0f);
var B = new Interval(2.5f, 7.5f);
var C = new Interval(6.0f, 10.0f);
Assert.IsTrue(A.Intersects(B));
Assert.IsTrue(B.Intersects(C));
Assert.IsFalse(A.Intersects(C));
Assert.IsTrue(B.Intersects(A));
Assert.IsTrue(C.Intersects(B));
Assert.IsFalse(C.Intersects(A));
Assert.IsTrue(A.Intersects(A));
Assert.IsTrue(B.Intersects(B));
Assert.IsTrue(C.Intersects(C));
}
示例2: IntervalIntersection
public void IntervalIntersection(int s1, int e1, int s2, int e2, bool expected)
{
Interval<int> a = new Interval<int>(s1, e1);
Interval<int> b = new Interval<int>(s2, e2);
if (expected)
{
Assert.True(a.Intersects(b));
Assert.True(b.Intersects(a));
}
else
{
Assert.False(a.Intersects(b));
Assert.False(b.Intersects(a));
}
}
示例3: Intersects
public void Intersects()
{
IInterval<int> interval1 = new Interval<int>(5, 10);
IInterval<int> interval2 = new Interval<int>(7, 15);
IInterval<int> interval3 = new Interval<int>(0, 5);
Assert.IsTrue(interval1.Intersects(interval2));
Assert.IsTrue(interval2.Intersects(interval1));
Assert.IsTrue(interval1.Intersects(interval3));
Assert.IsTrue(interval3.Intersects(interval1));
Assert.IsFalse(interval2.Intersects(interval3));
Assert.IsFalse(interval3.Intersects(interval2));
}