Exemple #1
0
        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
            {
            }

            Invalidate();
        }
Exemple #2
0
 private void miCirclesInfo_Click(object sender, EventArgs e)
 {
     FormTemp ft = new FormTemp() { Width = this.Width, Text = "Введите количество кругов, минимальный и максимальный радиусы кругов", Info = "0 0 0" };
     ft.ShowDialog(this);
     try
     {
         string[] s = ft.Info.Split(' ');
         int n = int.Parse(s[0]);
         double min = double.Parse(s[1]);
         double max = double.Parse(s[2]);
         for (int i = 0; i < n; i++)
             circles.Add(new Circle { Pole = new Point2d { X = double.NegativeInfinity, Y = 0 }, Scalar = min + (max - min) * rand.NextDouble() });
     }
     catch
     {
     }
     Invalidate();
 }
Exemple #3
0
 private void miCircleInfo_Click(object sender, EventArgs e)
 {
     FormTemp ft = new FormTemp() { Width = this.Width, Text = "Введите радиус круга", Info = (height * rand.NextDouble()).ToString() };
     ft.ShowDialog(this);
     try
     {
         circles.Add(new Circle { Pole = new Point2d { X = double.NegativeInfinity, Y = 0 }, Scalar = double.Parse(ft.Info) });
     }
     catch
     {
     }
     Invalidate();
 }
Exemple #4
0
 private void miInterval_Click(object sender, EventArgs e)
 {
     FormTemp ft = new FormTemp() { Width = this.Width, Text = "Введите интервал таймера", Info = timer.Interval.ToString() };
     ft.ShowDialog(this);
     try
     {
         timer1.Interval = int.Parse(ft.Info);
     }
     catch
     {
     }
 }
Exemple #5
0
        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();
        }