示例#1
0
        private void Track(Point currentPosition)
        {
            Vector3D currentPosition3D = currentPosition.ProjectToTrackball(
                _viewport.ActualWidth, _viewport.ActualHeight);
            Vector3D axis  = Vector3D.CrossProduct(_previousPosition3D, currentPosition3D);
            double   angle = Ext3D.AngleBetween(_previousPosition3D, currentPosition3D);

            axis = Ext3D.Transform(axis, _cameraRotate);
            Methods.RotateCameraResult rcr = _camera.RotateCamera(axis, -angle);
            _cameraRotate *= rcr.RotateMatrix;
            _viewMatrix    = rcr.ViewMatrix;
            OnLayoutUpdated();
            _previousPosition3D = currentPosition3D;
        }
示例#2
0
        void ResetCamera()
        {
            _cameraZ              = _cameraNear; _cameraMove = 0;
            _camera.Position      = new Point3D(0, 0, _cameraNear); //60
            _camera.LookDirection = new Vector3D(0, 0, -1);
            _camera.UpDirection   = new Vector3D(0, 1, 0);
            _camera.FieldOfView   = 80;

            Matrix3D vm = Matrix3D.Identity;

            _cameraRotate = _camera.RotateCamera(new Vector3D(0, 1, 0), Math.PI / 6).RotateMatrix;
            Vector3D axis = new Vector3D(1, 0, 0); axis = Ext3D.Transform(axis, _cameraRotate);

            Methods.RotateCameraResult rcr = _camera.RotateCamera(axis, -Math.PI / 6);
            _cameraRotate *= rcr.RotateMatrix;
            _viewMatrix    = rcr.ViewMatrix;
        }