Example #1
0
        public Neuron(Vector2f position, float radius, float bias)
        {
            float occlusion = 0.8f;

            outer = new CircleShape(radius)
            {
                Position  = position,
                FillColor = new Color(90, 90, 90),
            };
            inner = new CircleShape(radius * occlusion)
            {
                FillColor = new Color(0, 0, 0),
                Position  = position,
            };
            SFMLGeometryUtility.AlignCircles(ref outer, ref inner);
            CenterPoint = SFMLGeometryUtility.CalculateCenter(ref outer);
            ChangeActivation(0f);

            BiasPopup = new Popup(CenterPoint);
            Bias      = bias;
            BiasPopup.UpdateText("Bias: " + bias.ToString());

            ShouldBeDrawn       = true;
            ShouldDrawBiasPopup = false;
        }
Example #2
0
 public Connection(Neuron from, Neuron to, float width)
 {
     fromN          = from;
     toN            = to;
     this.from      = from.CenterPoint;
     this.to        = to.CenterPoint;
     line           = SFMLGeometryUtility.GenerateLine(ref this.from, ref this.to, width);
     line.FillColor = new Color(20, 20, 20, 100);    // From visual trial and error.
     minOpacity     = 1;                             // Based on RGB scheme.
     maxOpacity     = 255;                           // Based on RGB scheme.
     weight         = 0f;
 }