Using the Camera

To add support for the camera

Start with the project you created in Transformation.

  1. Add this local variable under L_INT nRet; in the WndProc function:

    VECTORCAMERA Camera; 

  2. Add these lines right after the break; statement of case '-': in WM_CHAR:

    case 'b':   
    case 'B':   
       // flip camera projection between parallel and perspective   
       L_VecGetCamera ( &Vector, &Camera );   
       Camera.bPerspective = !Camera.bPerspective;   
       L_VecSetCamera ( &Vector, &Camera );   
       InvalidateRect( hWnd, NULL, FALSE );   
       break;   
    case 'T':   
    case 't':   
       // rotate the camera theta angle   
       L_VecGetCamera( &Vector, &Camera );   
       Camera.Theta += 5.0;   
       L_VecSetCamera( &Vector, &Camera );   
       InvalidateRect( hWnd, NULL, FALSE );   
       break;   
    case 'P':   
    case 'p':   
       // rotate the camera phi angle   
       L_VecGetCamera ( &Vector, &Camera );   
       Camera.Phi += 5.0;   
       L_VecSetCamera ( &Vector, &Camera );   
       InvalidateRect( hWnd, NULL, FALSE );   
       break; 

  3. Compile and run the demo.

  4. Select File/Open from the program menu. Browse to C:\LEADTOOLS23\Resources\Images\random.dxf and click OK.

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

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Vector C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.