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


C# Vertex.GetTriples方法代码示例

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


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

示例1: tsmiLoad_Click

        private void tsmiLoad_Click(object sender, EventArgs e)
        {
            StreamReader sr = new StreamReader("data.txt");
            miClear_Click(null, null);
            height = double.Parse(sr.ReadLine());
            int n = int.Parse(sr.ReadLine());
            for (int i = 0; i < n; i++)
                circles.Add(new Circle { Value = double.Parse(sr.ReadLine()) });

            #region Шаг 1. Создаём начальную модель, состоящую из сторон прямоуольника. !!!Потом переделать на полосу!!!
            List<Geometric2d> borders = new List<Geometric2d>();
            borders.Add(new Plane2d { Pole = new Point2d { X = ClientRectangle.Width / 2, Y = height }, Normal = new Vector2d { X = 0, Y = -1 } });
            borders.Add(new Plane2d { Pole = new Point2d { X = 0, Y = height / 2 }, Normal = new Vector2d { X = 1, Y = 0 } });
            borders.Add(new Plane2d { Pole = new Point2d { X = ClientRectangle.Width / 2, Y = 0 }, Normal = new Vector2d { X = 0, Y = 1 } });

            vertex = Vertex<Geometric2d>.CreateClosenessModel(borders[0], borders[1], borders[2]);
            vertex.BreakCrosBy(new Plane2d { Pole = new Point2d { X = ClientRectangle.Width, Y = height / 2 }, Normal = new Vector2d { X = -1, Y = 0 } }); // Добавить четвёртую сторону.
            #endregion

            #region Шаг 2. Устанавливаем для полученных троек круги Делоне. !!Нужно ли автоматизировать!!
            vertex.SetCircleDelone(new Circle { Pole = new Point2d { X = height / 2, Y = height / 2 }, Value = height / 2 });
            vertex.Cros.SetCircleDelone(new Circle { Pole = new Point2d { X = ClientRectangle.Width - height / 2, Y = height / 2 }, Value = height / 2 });

            vertex.Prev.Cros.SetCircleDelone(new Circle());
            vertex.Cros.Prev.Cros.SetCircleDelone(new Circle());
            #endregion

            triples = vertex.GetTriples();
            //vertex = vertex.Cros;

            Invalidate();
        }
开发者ID:Ring-r,项目名称:opt,代码行数:32,代码来源:FormMain.cs

示例2: PlacingWithCloseModel

        public PlacingWithCloseModel(double height, Circle[] circles, double eps)
            : base(height, 0, circles, eps)
        {
            length = 2 * height;

            #region Шаг 1. Создаём начальную модель, состоящую из сторон прямоугольника. !!!Потом переделать на полосу!!!
            Geometric2d border_1 = new Plane2d { Id = -1, Pole = new Point2d { X = 0, Y = 2 * height / 2 }, Normal = new Vector2d { X = 0, Y = -1 } };
            Geometric2d border_2 = new Plane2d { Id = -2, Pole = new Point2d { X = 0, Y = 1 * height / 2 }, Normal = new Vector2d { X = 1, Y = 0 } };
            Geometric2d border_3 = new Plane2d { Id = -3, Pole = new Point2d { X = 0, Y = 0 * height / 2 }, Normal = new Vector2d { X = 0, Y = +1 } };

            Geometric2d border_4 = new Plane2d { Id = -4, Pole = new Point2d { X = length, Y = height / 2 }, Normal = new Vector2d { X = -1, Y = 0 } };

            vertex = Vertex<Geometric2d>.CreateClosenessModel(border_1, border_2, border_3);
            vertex.BreakCrosBy(border_4);
            #endregion

            #region Шаг 2. Устанавливаем для полученных троек круги Делоне. !Для полосы можно не автоматизировать. Для многоугольника необходимо придумать автоматизацию.
            vertex.SetCircleDelone(new Circle { Pole = new Point2d { X = height / 2, Y = height / 2 }, Scalar = height / 2 });
            vertex.Cros.SetCircleDelone(new Circle { Pole = new Point2d { X = length - height / 2, Y = height / 2 }, Scalar = height / 2 });

            vertex.Prev.Cros.SetCircleDelone(new Circle { Pole = new Point2d { X = -height / 2, Y = height / 2 }, Scalar = 0 });
            vertex.Cros.Prev.Cros.SetCircleDelone(new Circle { Pole = new Point2d { X = double.PositiveInfinity /*length + height / 2*/, Y = height / 2 }, Scalar = 0 });
            #endregion

            length = 0;

            vertex = vertex.Cros.Next.Cros.Next;

            triples = vertex.GetTriples();
        }
开发者ID:Ring-r,项目名称:opt,代码行数:30,代码来源:Метод_последовательного_одиночного_размещения.cs

示例3: miStripInfo_Click

        private void miStripInfo_Click(object sender, EventArgs e)
        {
            FormTemp ft = new FormTemp() { Width = this.Width, Text = "Введите ширину полосы", Info = height.ToString() };
            ft.ShowDialog(this);
            try
            {
                height = double.Parse(ft.Info);
            }
            catch
            {
            }

            #region Шаг 1. Создаём начальную модель, состоящую из сторон прямоуольника. !!!Потом переделать на полосу!!!
            List<Geometric2d> borders = new List<Geometric2d>();
            borders.Add(new Plane2d { Pole = new Point2d { X = ClientRectangle.Width / 2, Y = height }, Normal = new Vector2d { X = 0, Y = -1 } });
            borders.Add(new Plane2d { Pole = new Point2d { X = 0, Y = height / 2 }, Normal = new Vector2d { X = 1, Y = 0 } });
            borders.Add(new Plane2d { Pole = new Point2d { X = ClientRectangle.Width / 2, Y = 0 }, Normal = new Vector2d { X = 0, Y = 1 } });

            vertex = Vertex<Geometric2d>.CreateClosenessModel(borders[0], borders[1], borders[2]);
            vertex.BreakCrosBy(new Plane2d { Pole = new Point2d { X = ClientRectangle.Width, Y = height / 2 }, Normal = new Vector2d { X = -1, Y = 0 } }); // Добавить четвёртую сторону.
            #endregion

            #region Шаг 2. Устанавливаем для полученных троек круги Делоне. !!Нужно ли автоматизировать!!
            vertex.SetCircleDelone(new Circle { Pole = new Point2d { X = height / 2, Y = height / 2 }, Value = height / 2 });
            vertex.Cros.SetCircleDelone(new Circle { Pole = new Point2d { X = ClientRectangle.Width - height / 2, Y = height / 2 }, Value = height / 2 });

            vertex.Prev.Cros.SetCircleDelone(new Circle());
            vertex.Cros.Prev.Cros.SetCircleDelone(new Circle());
            #endregion

            triples = vertex.GetTriples();
            //vertex = vertex.Cros;

            Invalidate();
        }
开发者ID:Ring-r,项目名称:opt,代码行数:35,代码来源:FormMain.cs


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