Ejemplo n.º 1
0
        protected override void Initialize()
        {
            prox_list = new ProxList(Proximity, Widget.MAXIMUM_WIDGET_SIZE, Widget.MAXIMUM_WIDGET_SIZE);

            var area = new RectangleF(0, 0, 1920 + 400, 1080 + 400);

            //Parent.Area.SizeOnly().ResizedBy(100f, Directions2D.DR);

            for (var i = 0; i < circle_count; i++)
            {
                circles.Add(NeuronsCircle.RandomCircle(prox_list, area));
            }

            if (Parent.ParentDWindow is null)
            {
                return;
            }

            LoadContent(this, EventArgs.Empty);
        }
Ejemplo n.º 2
0
        void UpdateCircleLines(NeuronsCircle circle)
        {
            foreach (var neighbor in prox_list.GetNeighbors(circle.circle_position))
            {
                // use x * y to determine the first point in the rectangle (smaller first) to avoid duplicate lines
                var transparency = 1f - (float)circle.circle_position.Position.DistanceFrom(neighbor.Position) / (Proximity / 2);

                if (!(transparency > 0f))
                {
                    continue;
                }

                if (circle.circle_position.Position.Product() < neighbor.Position.Product())
                {
                    lines.TryAdd(
                        new RectangleF(
                            circle.circle_position.X,
                            circle.circle_position.Y,
                            neighbor.X,
                            neighbor.Y
                            ), transparency
                        );
                }
                else
                {
                    lines.TryAdd(
                        new RectangleF(
                            neighbor.X,
                            neighbor.Y,
                            circle.circle_position.X,
                            circle.circle_position.Y
                            ), transparency
                        );
                }
            }
        }
Ejemplo n.º 3
0
 public void AddRandomCircle(RectangleF area) =>
 circles.Add(NeuronsCircle.RandomCircle(prox_list, area));