Beispiel #1
0
        private static void DrawWave(RenderWindow window, Wave bestWave, int i = 5)
        {
            int      x         = 0;
            Vertex   oldVertex = new Vertex(new Vector2f(x, i * 128));
            Drawable text      = new Text
            {
                DisplayedString = AbsoluteDifference(bestWave).ToString(),
                CharacterSize   = 10,
                Position        = new Vector2f(100, i * 128),
                Font            = new Font("c:\\windows\\fonts\\arial.ttf")
            };

            window.Draw(text);

            foreach (var pitch in bestWave.Generate(Length))
            {
                var line      = new Vertex[2];
                var newVertex = new Vertex(new Vector2f(x, (i + 1) * 128 - pitch / 2));
                line[0] = oldVertex;
                line[1] = newVertex;
                x++;
                window.Draw(line, PrimitiveType.Lines);
                oldVertex = newVertex;
            }
        }
Beispiel #2
0
 private static double AbsoluteDifference(Wave a)
 {
     return(a.Generate(Length).AbsoluteDifference(_constWave));
 }