コード例 #1
0
        static void Main(string[] args)
        {
            IntMatrix progressionMatrix = new IntMatrix(new int[][] {
                new int[] { 0, -1, 0 },
                new int[] { 0, 0, -1 },
                new int[] { -1, 0, 0 }
            });

            IntMatrix deltaVector = new IntMatrix(new int[][] {
                new int[] { 0 },
                new int[] { 1 },
                new int[] { 0 }
            });

            int time = 10;
            int R    = 100;
            int G    = 0;
            int B    = 0;

            while (true)
            {
                Console.WriteLine(String.Format("delta: ({0}, {1}, {2})", deltaVector.ElementAt(0, 0), deltaVector.ElementAt(1, 0), deltaVector.ElementAt(2, 0)));
                Fade(ref R, ref G, ref B, deltaVector.ElementAt(0, 0), deltaVector.ElementAt(1, 0), deltaVector.ElementAt(2, 0), time);
                deltaVector = progressionMatrix * deltaVector;
            }
        }
コード例 #2
0
ファイル: IntMatrix.cs プロジェクト: mowbrf/BusyLightTest
        void test()
        {
            IntMatrix v = new IntMatrix(new int[][] {
                new int[] { 1, 2, 3 }
            });

            IntMatrix w = new IntMatrix(new int[][] {
                new int[] { 1 },
                new int[] { 1 },
                new int[] { 1 }
            });

            var r = v * w;

            Console.WriteLine(String.Format("({0})", r.ElementAt(0, 0)));

            IntMatrix m = new IntMatrix(new int[][] {
                new int[] { 0, 0, -1 },
                new int[] { -1, 0, 0 },
                new int[] { 0, -1, 0 }
            });

            IntMatrix s = new IntMatrix(new int[][] {
                new int[] { 1 },
                new int[] { 0 },
                new int[] { 0 }
            });

            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine(String.Format("({0}, {1}, {2})", s.ElementAt(0, 0), s.ElementAt(1, 0), s.ElementAt(2, 0)));
                s = m * s;
            }

            Console.ReadLine();
        }