コード例 #1
0
ファイル: tests_pos3D.cs プロジェクト: kasertim/sentience
        public void PanTilt()
        {
            int pan_angle1 = -40;
            float pan1 = pan_angle1 * (float)Math.PI / 180.0f;
            int tilt_angle1 = 20;
            float tilt1 = tilt_angle1 * (float)Math.PI / 180.0f;
            
            pos3D pos1 = new pos3D(0, 50, 0);
            pos3D pos2 = pos1.rotate_old(pan1,tilt1,0);
            pos3D pos3 = pos1.rotate(pan1,tilt1,0);
            
            float dx = Math.Abs(pos2.x - pos3.x);
            float dy = Math.Abs(pos2.y - pos3.y);
            float dz = Math.Abs(pos2.z - pos3.z);
            Console.WriteLine("pos old: " + pos2.x.ToString() + ",  " + pos2.y.ToString() + ",  " + pos2.z.ToString());
            Console.WriteLine("pos new: " + pos3.x.ToString() + ",  " + pos3.y.ToString() + ",  " + pos3.z.ToString());
            Assert.Less(dx, 1);
            Assert.Less(dy, 1);
            Assert.Less(dz, 1);
	    }
コード例 #2
0
ファイル: tests_pos3D.cs プロジェクト: kasertim/sentience
        public void Roll()
        {
            int roll_angle1 = 20;
            float roll1 = roll_angle1 * (float)Math.PI / 180.0f;
            
            pos3D pos1 = new pos3D(50, 0, 0);
            pos3D pos2 = pos1.rotate_old(0,0,roll1);
            pos3D pos3 = pos1.rotate(0,0,roll1);
            
            float dx = Math.Abs(pos2.x - pos3.x);
            float dy = Math.Abs(pos2.y - pos3.y);
            float dz = Math.Abs(pos2.z - pos3.z);
            Console.WriteLine("pos old: " + pos2.x.ToString() + ",  " + pos2.y.ToString() + ",  " + pos2.z.ToString());
            Console.WriteLine("pos new: " + pos3.x.ToString() + ",  " + pos3.y.ToString() + ",  " + pos3.z.ToString());
            Assert.Less(dx, 1);
            Assert.Less(dy, 1);
            Assert.Less(dz, 1);
	    }