本文整理匯總了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));
}