本文整理汇总了C#中System.Line.TestIntersection方法的典型用法代码示例。如果您正苦于以下问题:C# Line.TestIntersection方法的具体用法?C# Line.TestIntersection怎么用?C# Line.TestIntersection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Line
的用法示例。
在下文中一共展示了Line.TestIntersection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LineIntersection
public void LineIntersection()
{
Line horizontalLine = new Line(new Vector2D(0.0f, 1.0f), new Vector2D(2.0f, 1.0f));
Line verticalLine = new Line(new Vector2D(1.0f, 0.0f), new Vector2D(1.0f, 2.0f));
Assert.IsTrue(horizontalLine.TestIntersection(verticalLine));
Assert.IsTrue(horizontalLine.TestIntersection(horizontalLine));
Assert.IsTrue(verticalLine.TestIntersection(verticalLine));
Line offsetHorizontalLine = new Line(new Vector2D(0.0f, 3.0f), new Vector2D(2.0f, 3.0f));
Assert.IsFalse(offsetHorizontalLine.TestIntersection(horizontalLine));
Line reverseHorizontalLine = new Line(new Vector2D(2.0f, 1.0f), new Vector2D(0.0f, 1.0f));
Line reverseVerticalLine = new Line(new Vector2D(1.0f, 2.0f), new Vector2D(1.0f, 0.0f));
Line reverseOffsetHorizontalLine = new Line(new Vector2D(0.0f, 3.0f), new Vector2D(2.0f, 3.0f));
Assert.IsTrue(reverseHorizontalLine.TestIntersection(reverseVerticalLine));
Assert.IsTrue(reverseHorizontalLine.TestIntersection(verticalLine));
Assert.IsTrue(reverseVerticalLine.TestIntersection(verticalLine));
Assert.IsTrue(reverseVerticalLine.TestIntersection(reverseVerticalLine));
Assert.IsFalse(reverseHorizontalLine.TestIntersection(reverseOffsetHorizontalLine));
Assert.IsFalse(reverseHorizontalLine.TestIntersection(offsetHorizontalLine));
}