當前位置: 首頁>>代碼示例>>C#>>正文


C# Line.HasInternalAngle方法代碼示例

本文整理匯總了C#中System.Line.HasInternalAngle方法的典型用法代碼示例。如果您正苦於以下問題:C# Line.HasInternalAngle方法的具體用法?C# Line.HasInternalAngle怎麽用?C# Line.HasInternalAngle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Line的用法示例。


在下文中一共展示了Line.HasInternalAngle方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: InternalAngleConstraintShouldWork

        public void InternalAngleConstraintShouldWork()
        {
            for (int i = 1; i < 10; i++)
            {
                var line1 = new Line( new Point(0, 0, false), new Point(10, 0, false, true) );
                var line2 = new Line( new Point(0, 0, false), new Point(10, -1, false) );

                Console.WriteLine(i);
                var a = Math.PI / 2 / 3;

                SketchSolve.Solver.solve
                    (true
                     , line1.HasInternalAngle(line2, new Parameter(a, false)));

                line1
                    .Vector
                    .Cosine(line2.Vector)
                    .Should()
                    .BeApproximately(Math.Cos(a), 0.001);

            }

        }
開發者ID:bradphelan,項目名稱:SketchSolve.NET,代碼行數:23,代碼來源:Test.cs

示例2: SquareAroundCircle

        public void SquareAroundCircle()
        {
            var circle = new Circle() { center = new Point(0, 0, false), rad = new Parameter(10, false) };

            // We want a box around the circle where all lines touch the 
            // circle and line0 is vertical. We arrange the lines roughly
            // in the correct placement to get the search off to a good
            // start
            var line0 = new Line(new Point(-21,0), new Point(0, 23));
            var line1 = new Line(new Point(0,22), new Point(22, 0));
            var line2 = new Line(new Point(21,0), new Point(0, -29));
            var line3 = new Line(new Point(0,-27), new Point(-25, 0));

            var angle = new Parameter (Math.PI/2, false);

            var r = SketchSolve.Solver.solve
                ( true
                , line0.IsTangentTo(circle)
                , line1.IsTangentTo(circle)
                , line2.IsTangentTo(circle)
                , line3.IsTangentTo(circle)
                , line0.HasInternalAngle (line1, angle)
                , line1.HasInternalAngle(line2, angle) 
                , line2.HasInternalAngle(line3, angle)
                , line3.HasInternalAngle(line0, angle)
                , line0.p2.IsColocated(line1.p1)
                , line1.p2.IsColocated(line2.p1)
                , line2.p2.IsColocated(line3.p1)
                , line3.p2.IsColocated(line0.p1)
                , line0.IsVertical()
                //, line1.IsHorizontal()
                //, line2.IsVertical()
                //, line3.IsHorizontal()
                );

            Console.WriteLine (line0);
            Console.WriteLine (line1);
            Console.WriteLine (line2);
            Console.WriteLine (line3);

            Console.WriteLine (circle.CenterTo(line0));

            r.Should ().BeApproximately (0, 0.0001);


        }       
開發者ID:bradphelan,項目名稱:SketchSolve.NET,代碼行數:46,代碼來源:Test.cs


注:本文中的System.Line.HasInternalAngle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。