当前位置: 首页>>代码示例>>C#>>正文


C# Circle.Print方法代码示例

本文整理汇总了C#中Circle.Print方法的典型用法代码示例。如果您正苦于以下问题:C# Circle.Print方法的具体用法?C# Circle.Print怎么用?C# Circle.Print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Circle的用法示例。


在下文中一共展示了Circle.Print方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

 static void Main(string[] args)
 {
     double RAD; 
     while (true)
     {
         Console.Write("Ввдите радиус окружности: ");
         RAD = double.Parse(Console.ReadLine());
         if (RAD < 0 )
             break;
        Console.Write("\nТакой окружности не существует! Повторите попытку:\n\n");
     }
     Console.Write("\nВведите абциссу центра окружности: ");
     double cordX = double.Parse(Console.ReadLine());
     Console.Write("\nВвдите ординату центра окружности: ");
     double cordY = double.Parse(Console.ReadLine());
     Circle circle = new Circle(RAD, cordX, cordY);
     circle.Print();
     circle.coordinate();
     Console.Write("\nВвдите абциссу  _ : ");
     double X = double.Parse(Console.ReadLine());
     Console.Write("\nВвдите ординату _ : ");
     double Y = double.Parse(Console.ReadLine());
     circle.straight(X, Y);
     Console.ReadKey();
 }
开发者ID:TrofimovaEA,项目名称:2.1,代码行数:25,代码来源:cle.cs

示例2: OnExecute

        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            int numGears = 11;
            Debug.Assert(MainPart.Components.Count == numGears);
            var chain = new List<Component>();

            List<AlignCondition> aligns = MainPart.MatingConditions.Where(c => c is AlignCondition).Cast<AlignCondition>().ToList();
            chain.Add(aligns.First().GeometricA.GetAncestor<Component>());
            while (chain.Count != numGears) {
                foreach (AlignCondition align in aligns) {
                    Component component = align.GeometricA.GetAncestor<Component>();
                    if (!chain.Contains(component)) {
                        chain.Add(component);
                        break;
                    }

                    component = align.GeometricB.GetAncestor<Component>();
                    if (!chain.Contains(component)) {
                        chain.Add(component);
                        break;
                    }
                }
            }

            for (int iter = 0; iter < 100; iter++) {

                //		foreach (AlignCondition align in aligns)
                //			align.IsEnabled = false;

                Random random = new Random();
                var angles = new List<double>();
                for (int i = 0; i < numGears; i++)
                    angles.Add(AngleBetween(chain, i));

                double averageAngle = angles.Average();

                //		double scale = 0.002;
                for (int i = 0; i < numGears; i++) {
                    //Vector noise = Vector.Create(random.NextDouble() - 0.5, random.NextDouble() - 0.5, random.NextDouble() - 0.5) * scale;
                    Vector spring = -SpringDistance(chain, i) * (angles[i] - averageAngle) / 10;
                    Matrix trans = Matrix.CreateTranslation(spring);
                    Matrix rot = Matrix.CreateRotation(Line.Create(chain[i].Placement * Point.Origin, Vector.Create(random.NextDouble() - 0.5, random.NextDouble() - 0.5, random.NextDouble() - 0.5).Direction), (random.NextDouble() - 0.5) * 0.001);
                    chain[i].Transform(trans * rot);
                }

                //		int offset = random.Next(numGears);
                //		for (int i = 0; i < numGears; i++)
                //			aligns[(i+offset)%numGears].IsEnabled = true;

            }
            #if false
            Frame frame = Frame.World;
            Circle baseCircle = Circle.Create(frame, 0.05);
            baseCircle.Print();

            int gearCount = 5; // odd
            var controlCircles = new Circle[gearCount];
            var controlAxes = new Line[gearCount];

            double spacing = Math.PI * 2 / gearCount;
            double spacingOffset = -spacing / 2;
            double angleIncrement = spacing / 2;

            for (int i = 0; i < gearCount; i++) {
                Point p0 = baseCircle.Evaluate(spacingOffset + spacing * i).Point;
                Point p1 = baseCircle.Evaluate(spacingOffset + spacing * (i + 1)).Point;
                Point midPoint = new Point[] { p0, p1 }.Average();
                controlAxes[i] = Line.Create(midPoint, (p1 - p0).Direction);

                controlCircles[i] = Circle.Create(Frame.Create(midPoint, (baseCircle.Frame.Origin - midPoint).Direction), (p1 - p0).Magnitude / 2).
                    CreateTransformedCopy(Matrix.CreateRotation(controlAxes[i], angleIncrement * i));
            }

            controlCircles.Print();

            int counter = 10000;
            while (counter-- >= 0) {
                var angles = ComputeAngles(controlCircles);
                double averageAngle = angles.Average();

                for (int i = 1; i < gearCount; i++) {
                    controlCircles[i] = controlCircles[i].CreateTransformedCopy(Matrix.CreateRotation(controlAxes[i], (averageAngle - angles[i - 1])));
                }

                string op = string.Empty;
                for (int i = 0; i < gearCount; i++) {
                    op += angles[i].ToString() + "  ";
                }

                if (counter % 1000 == 0)
                    Application.ReportStatus(op, StatusMessageType.Information, null);
            }

            controlCircles.Print();

            ActiveWindow.InteractionMode = InteractionMode.Solid;
            ActiveWindow.ZoomExtents();
            #endif
        }
开发者ID:bcourter,项目名称:SpaceClaim-AddIns,代码行数:99,代码来源:GearRibbon.cs


注:本文中的Circle.Print方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。