示例#1
0
        private void DrawNetworkAnswer()
        {
            wpfGraphics.Clear();
            Parallel.For(0, 300, x =>
            {
                Parallel.For(0, 300, y =>
                {
                    double[,] input = new double[, ] {
                        { ((double)x / 300), ((double)y / 300) }
                    };
                    double[,] result = nn.CheckAnswer(input);

                    byte color = 0;
                    //if (result[0, 0] >= 0)
                    //    color = (byte)(127 + (byte)(result[0, 0] * 127));
                    //else
                    //    color = (byte)(127 + (byte)(result[0, 0] * 127));
                    if (result[0, 0] > 0)
                    {
                        color = (byte)(127 + (byte)(result[0, 0] * 127));
                        wpfGraphics.SetPixel(x, y, 0, color, 0);
                    }
                    else
                    {
                        color = (byte)(127 + (byte)(result[0, 1] * 127));
                        wpfGraphics.SetPixel(x, y, color, color, 0);
                    }
                });
            });

            DrawPoints();
        }
 private void DrawNetworkAnswer()
 {
     wpfGraphics.Clear();
     Parallel.For(0, 100, x =>
     {
         Parallel.For(0, 100, y =>
         {
             double[,] input  = new double[1, 2];
             input[0, 0]      = (double)(((double)(x - 50)) / 50);
             input[0, 1]      = (double)(((double)(y - 50)) / 50);
             double[,] result = nn.CheckAnswer(input);
             wpfGraphics.SetPixel(x, y, getByte(result[0, 0]), getByte(result[0, 1]), getByte(result[0, 2]));
         });
     });
     wpfGraphics.Draw();
 }