Using the Camera

Start with the project you created in Transformation.

Take the following steps to add support for the camera:

1.

Click the Class View tab in the project workspace.

2.

Click to open the "MyVectorWindow" branch to display the class member functions.

3.

Double click the MsgProcCallBack () member function.

4.

Add a local variable after the VECTORPOINT VecPoint declaration:

VECTORCAMERA VecCamera;

5.

Add the following cases to the switch(wParam) switch statement (immediately before the case 'x'):

         case 'b':
         case 'B':
            // flip camera projection between parallel and perspective
            GetCamera(&VecCamera );
            VecCamera.bPerspective = !VecCamera.bPerspective;
            SetCamera(&VecCamera );
            break;
            
         case 'T':
         case 't':
            // rotate the camera theta angle
            GetCamera(&VecCamera );
            VecCamera.Theta += 5.0;
            SetCamera(&VecCamera );
            break;
            
         case 'P':
         case 'p':
            // rotate the camera phi angle
            GetCamera(&VecCamera );
            VecCamera.Phi += 5.0;
            SetCamera(&VecCamera );
            break;

6.

Compile and run the demo.

7.

From the program menu, browse to the "images" folder of your LEAD installation. Open the image random.dxf and click OK.

8.

Now you should be able to rotate the camera using the T and P keys on your keyboard, and flip projection between parallel and perspective using the B key.