本文整理匯總了C#中System.Line.IsHorizontal方法的典型用法代碼示例。如果您正苦於以下問題:C# Line.IsHorizontal方法的具體用法?C# Line.IsHorizontal怎麽用?C# Line.IsHorizontal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Line
的用法示例。
在下文中一共展示了Line.IsHorizontal方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: HorizontalConstraintShouldWork
public void HorizontalConstraintShouldWork()
{
var line = new Line(new Point(0, 1, false), new Point(2, 3, false, true) );
var error = SketchSolve.Solver.solve
(true
, line.IsHorizontal()
);
error.Should ().BeApproximately (0, 0.0001);
line.p1.y.Value.Should().BeApproximately(line.p2.y.Value, 0.001);
}
示例2: TangentToCircleConstraintWithLineInitiallyHorizontalShouldWork
public void TangentToCircleConstraintWithLineInitiallyHorizontalShouldWork()
{
// Create a fully constrained circle at 0,0 with radius 1
var circle = new Circle() { center = new Point(0, 0, false), rad = new Parameter(10, false) };
var v = -15;
var line = new Line(new Point(-100, -v, false, true), new Point(100, -v*2.1, false, true));
var r = SketchSolve.Solver.solve
( true
, line.IsTangentTo(circle)
, line.IsHorizontal()
);
Console.WriteLine (line);
Console.WriteLine (circle);
(circle.CenterTo (line).Vector.LengthSquared - circle.rad.Value*circle.rad.Value)
.Should ()
.BeApproximately (0, 0.001);
}