Пример #1
0
        private void RandArrows(DCircle circle, int count = 100)
        {
            if (count == 0)
            {
                return;
            }

            chart1.Series.Add(counter++.ToString());
            chart1.Series.Last().IsVisibleInLegend = false;
            chart1.Series.Last().ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
            chart1.Series.Last().MarkerStyle       = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Star5;
            chart1.Series.Last().MarkerSize        = 8;
            chart1.Series.Last().BorderWidth       = 8;
            chart1.Series.Last().Color             = Color.Green;
            int    n   = chart1.Series.Count - 1;
            double cof = GetWindowsCoef();

            int    c = 0;
            Random r = new Random();
            double x, y, q = circle.Radius * cof;
            Point  f, p;

            while (c < count)
            {
                x = -q + r.NextDouble() * q * 2 + circle.Center.x;
                y = -q + r.NextDouble() * q * 2 + circle.Center.y;
                p = new Point(x, y);

                if (!circle.ContainPoint(p, 1.05))
                {
                    chart1.Series[n].Points.AddXY(x, y);
                    f = circle.GetNormal(p, 0.1 * q);
                    MakeArrow(new Point(p.x - f.x, p.y - f.y), f, Color.Blue, circle);
                    c++;
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Создать источник по полумесяцу и нужным массивам
 /// </summary>
 /// <param name="circle"></param>
 /// <param name="normals"></param>
 /// <param name="fmas"></param>
 public Source(DCircle circle, Complex[] fmas) : this(circle.Center, circle.GetNormalsOnDCircle(), p => circle.ContainPoint(p), fmas, Type.DCircle, circle.BigCircle.radius)
 {
 }