예제 #1
0
        public static void EyeTest()
        {
            //Two dudes. One at 0,0 the other at 100, 0
            //the first one just spins and we get

            Spacials pd = defaultSpacials();

            //Dude spinDude = new Dude ("Spin", pd);
            Dude spinDude = new Dude();

            spinDude.red   = 0;
            spinDude.green = 0;
            spinDude.blue  = 0;

            spinDude.update();

            //

//			Dude redDude = new Dude ("Red", pd);
//			redDude.red = 0;
//			redDude.green = 0;
//			redDude.blue = 0;

            //farDude.pd.x = 100;
//			redDude.spacials.x = 10;



            //Dude greenDude = new Dude ("Green", pd);
            Dude greenDude = new Dude();

            greenDude.red   = 1;
            greenDude.green = 1;
            greenDude.blue  = 1;

            //farDude.pd.x = 100;
            greenDude.spacials.pos.X = -10;

//
//			Dude blueDude = new Dude ("Blue", pd);
//			blueDude.red = 0;
//			blueDude.green = 0;
//			blueDude.blue = 0;
//
//			blueDude.spacials.y = 10;

            //

            string output = "";

            for (double a = -Math.PI; a < Math.PI; a += 0.1)
            {
                spinDude.spacials.angle = a;

                spinDude.checkSenses();

                output += spinDude.leftEyeSense[0].ToString() + ",";
                output += spinDude.leftEyeSense[1].ToString() + ",";
                output += spinDude.leftEyeSense[2].ToString() + ", ,";
                output += spinDude.rightEyeSense[0].ToString() + ",";
                output += spinDude.rightEyeSense[1].ToString() + ",";
                output += spinDude.rightEyeSense [2].ToString() + ",";
                output += spinDude.spacials.angle.ToString("F2") + "\r\n";
            }

            using (StreamWriter sw = new StreamWriter("EyeTest.csv"))
            {
                sw.Write(output);
            }
        }