public void CreateOldCamera()
        {
            var device = DeviceFactory.CreateDevice("OldCamera", "my old camera");
            var camera = new OldCamera("my old camera", new OldCameraCommChannel());

            //check name
            Assert.Equal(camera.Name, device.Name);
            //check type
            Assert.Equal(camera.GetType(), device.GetType());
            //check status
            Assert.Equal(camera.CheckStatus(), device.CheckStatus());
            //check Connection
            Assert.Equal(camera.CheckConnection(), device.CheckConnection());
        }
Exemple #2
0
        // TODO:
        /// <summary>
        /// Finds the theta and phi to best fit the camera
        /// </summary>
        /// <param name="camera"></param>
        public void FitThetaPhi( OldCamera camera )
        {
            var cameraForward = camera.ViewDirection;
            var cameraUp = camera.UpVector;

            // compute theta:
            // find theta such that the up vector
            // when rotated about groundPlaneUp lies in the 
            // (ground plane forward)-(ground plane up) plane

            // which is just the angle theta it makes projected onto the ground plane
            
            // TODO: define a ground plane point as well?  make it an affine basis...

            // first: take the incoming up vector in world coordinates
            // and transform it into the ground plane basis

            // var gpToWorld = new Matrix3f( GroundPlaneRight, GroundPlaneUp, -GroundPlaneForward );
            var gpToWorld = new Matrix3f( -GroundPlaneForward, GroundPlaneRight, GroundPlaneUp );
            var worldToGP = gpToWorld.Inverse();

            // camera up vector in local coordinates
            var cameraUpGP = worldToGP * cameraUp;

            // compute theta
            var cameraUpGPSpherical = GeometryUtils.RectangularToSpherical( cameraUpGP );

            Theta = cameraUpGPSpherical.y;
            // Phi = MathUtils.PI - cameraUpGPSpherical.z;
            Phi = 0;
        }
Exemple #3
0
        public FPSControls( FPSMouseParameters mouseParameters,
            FPSKeyboardParameters keyboardParameters,
            FPSXboxGamepadParameters xboxGamepadParameters,
            OldCamera camera )
        {
            MouseParameters = mouseParameters;
            KeyboardParameters = keyboardParameters;
            XboxGamepadParameters = xboxGamepadParameters;

            UpVector = Vector3f.Up;

            Camera = camera;
            mouseIsDown = false;
        }