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