예제 #1
0
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////


        // draw the score function  f(x,y)=ax+by+c
        static public void DrawScore(float a, float b, float c, int CAT)
        {
            Graphique G = Form1.G;

            for (int yecran = 0; yecran < G.GetH(); yecran++)
            {
                for (int xecran = 0; xecran < G.GetL(); xecran++)
                {
                    float x = G.XPixToVal(xecran);
                    float y = G.YPixToVal(yecran);

                    float score = a * x + b * y + c;

                    Color cc    = G.GetPixel(xecran, yecran);
                    float level = Utils.ColorToScore(cc);

                    if (score < level)
                    {
                        continue;
                    }

                    G.SetPixel(xecran, yecran, Utils.ScoreToColor(score, CAT));
                }
            }
        }
예제 #2
0
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////////////////////////////////////////

        static public void LevelSet(float[,] W, float value)
        {
            Graphique G = Form1.G;

            for (int yecran = 0; yecran < G.GetH(); yecran++)
            {
                for (int xecran = 0; xecran < G.GetL(); xecran++)
                {
                    float x = G.XPixToVal(xecran);
                    float y = G.YPixToVal(yecran);

                    float[] sco = new float[3];
                    for (int i = 0; i < 3; i++)
                    {
                        sco[i] = W[i, 0] * x + W[i, 1] * y + W[i, 2];
                    }

                    float mx = sco.Max();

                    if (Math.Abs(mx - value) < 0.001)
                    {
                        G.SetPixel(xecran, yecran, Color.Red);
                    }
                }
            }
        }
예제 #3
0
        public static void DrawFnt2D(FntXY Score)
        {
            Graphique G = Form1.G;

            for (int yecran = 0; yecran < G.GetL(); yecran++)
            {
                for (int xecran = 0; xecran < G.GetH(); xecran++)

                {
                    double x = Form1.G.XPixToVal(xecran);
                    double y = Form1.G.YPixToVal(yecran);
                    double s = Score(x, y);
                    Color  C = Utils.ScoreToHUE(s);
                    Form1.G.SetPixel(xecran, yecran, C);
                }
            }
        }
예제 #4
0
        // draw the score function  f(x,y)=ax+by+c
        static public void DrawScore()
        {
            Graphique G   = Form1.G;
            int       pas = 3;

            for (int yecran = 0; yecran < G.GetH(); yecran += pas)
            {
                for (int xecran = 0; xecran < G.GetL(); xecran += pas)
                {
                    float x = G.XPixToVal(xecran);
                    float y = G.YPixToVal(yecran);

                    // on calcule le score pour chaque pixel de l'ecran
                    float[] sco    = compute_score(x, y);
                    int     first  = 0;
                    int     second = 1;

                    // look for biggest and second biggest score
                    if ((sco[0] >= sco[1]) && (sco[1] >= sco[2]))
                    {
                        first = 0; second = 1;
                    }
                    if ((sco[0] >= sco[2]) && (sco[2] >= sco[1]))
                    {
                        first = 0; second = 2;
                    }
                    if ((sco[1] >= sco[0]) && (sco[0] >= sco[2]))
                    {
                        first = 1; second = 0;
                    }
                    if ((sco[1] >= sco[2]) && (sco[2] >= sco[0]))
                    {
                        first = 1; second = 2;
                    }
                    if ((sco[2] >= sco[0]) && (sco[0] >= sco[1]))
                    {
                        first = 2; second = 0;
                    }
                    if ((sco[2] >= sco[1]) && (sco[1] >= sco[0]))
                    {
                        first = 2; second = 1;
                    }

                    int   cat = first;
                    float h   = sco[first] - sco[second];
                    h *= 4;
                    Utils.Inside(0f, 1f, ref h);



                    int[,] Legende = { { 150, 150, 255 },
                                       { 150, 255, 150 },
                                       { 255, 150, 150 } };

                    int RR = (int)(Legende[cat, 0] * h);
                    int GG = (int)(Legende[cat, 1] * h);
                    int BB = (int)(Legende[cat, 2] * h);


                    Color c = Color.FromArgb(RR, GG, BB);
                    for (int xx = 0; xx < pas; xx++)
                    {
                        for (int yy = 0; yy < pas; yy++)
                        {
                            G.SetPixel(xecran + xx, yecran + yy, c);
                        }
                    }
                }
            }
        }
예제 #5
0
        // draw the score function  f(x,y)=ax+by+c
        static public void DrawScore(float[,] W)
        {
            Graphique G = Form1.G;

            for (int yecran = 0; yecran < G.GetH(); yecran++)
            {
                for (int xecran = 0; xecran < G.GetL(); xecran++)
                {
                    float x = G.XPixToVal(xecran);
                    float y = G.YPixToVal(yecran);

                    float[] sco = new float[3];
                    for (int i = 0; i < 3; i++)
                    {
                        sco[i] = W[i, 0] * x + W[i, 1] * y + W[i, 2];
                    }
                    int first  = 0;
                    int second = 1;

                    // look for biggest and second biggest score
                    if ((sco[0] >= sco[1]) && (sco[1] >= sco[2]))
                    {
                        first = 0; second = 1;
                    }
                    if ((sco[0] >= sco[2]) && (sco[2] >= sco[1]))
                    {
                        first = 0; second = 2;
                    }
                    if ((sco[1] >= sco[0]) && (sco[0] >= sco[2]))
                    {
                        first = 1; second = 0;
                    }
                    if ((sco[1] >= sco[2]) && (sco[2] >= sco[0]))
                    {
                        first = 1; second = 2;
                    }
                    if ((sco[2] >= sco[0]) && (sco[0] >= sco[1]))
                    {
                        first = 2; second = 0;
                    }
                    if ((sco[2] >= sco[1]) && (sco[1] >= sco[0]))
                    {
                        first = 2; second = 1;
                    }

                    int   cat = first;
                    float h   = sco[first] - sco[second];
                    h *= 4;
                    Utils.Inside(0, 1, ref h);



                    int[,] Legende = { { 150, 150, 255 },
                                       { 150, 255, 150 },
                                       { 255, 150, 150 } };

                    int RR = (int)(Legende[cat, 0] * h);
                    int GG = (int)(Legende[cat, 1] * h);
                    int BB = (int)(Legende[cat, 2] * h);

                    Color c = Color.FromArgb(RR, GG, BB);
                    G.SetPixel(xecran, yecran, c);
                }
            }
        }