本文整理汇总了C#中Line.XYIntercept方法的典型用法代码示例。如果您正苦于以下问题:C# Line.XYIntercept方法的具体用法?C# Line.XYIntercept怎么用?C# Line.XYIntercept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Line
的用法示例。
在下文中一共展示了Line.XYIntercept方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Line_XYIntercept
public void Line_XYIntercept()
{
Line line1 = new Line(Point.MakePointWithInches(3, 2, 1), Point.MakePointWithInches(5, 3, 2)); //intersects at 1, 1, 0
Line line2 = new Line(Point.MakePointWithInches(6, 0, -2), Point.MakePointWithInches(2, 3, -1)); //intersects at -2, 6, 0
Line line3 = new Line(Point.MakePointWithInches(3, 3, 5), Point.MakePointWithInches(2, 2, 4)); //intersects at -2,-2,0
Line line4 = new Line(Point.MakePointWithInches(4, 10, 1), Point.MakePointWithInches(4, 5, 2)); //intersects at 4, 15, 0
Line line5 = new Line(Point.MakePointWithInches(4, 2, 2), Point.MakePointWithInches(4, 1, 2)); //doesnt intersect
Point intercept1 = line1.XYIntercept();
Point intercept2 = line2.XYIntercept();
Point intercept3 = line3.XYIntercept();
Point intercept4 = line4.XYIntercept();
Point intercept5 = line5.XYIntercept();
intercept1.Should().Be(Point.MakePointWithInches(1, 1, 0));
intercept2.Should().Be(Point.MakePointWithInches(-2, 6, 0));
intercept3.Should().Be(Point.MakePointWithInches(-2, -2, 0));
intercept4.Should().Be(Point.MakePointWithInches(4, 15, 0));
intercept5.Should().Be(null);
}