OpenGL program assignment

AMAC MSc: Computational & Software Techniques in

Engineering Computer Graphics Assignment

You should build one Qt OpenGL program containing a menu with three items that allows the user to do the following:

  • Enter data using a dialog box (or similar) selected from a menu item entitled “line rotation” for the definition of a line in the form b+ud and an angle of rotation, phi. The code should then display the line and perform the rotation of the model about the line through the specified angle.

The matrix transformations for calculating the rotation about an arbitrary line b + ud are

P = F -1* G-1 * H-1 * W-1 * H * G * F:

where

  • = translation (-bx,-by,-bz)
  • = rotation about z by angle tan^{-1}(dy/-dx)
  • = rotation about y by angle tan^{-1}(v/dz), v = sqrt (dx^{2}+dy^{2}) W= rotation about z by angle phi
  • Enter data using a dialog box (or similar) selected from a menu item entitled “view position” for an eye position (eye: eye.x,eye.y,eye.z) and a direction of view (direct: direct.x,direct.y,direct.z). On entering this data and clicking OK your program should redisplay the model as seen from this vantage point.

For the default viewing position you should take a viewing position as eye=0,0,2 and the direction of view as direct=0,0,-1 (negative z). This should be the view of the cube that first appears on the screen when the program is run.

  • Include a menu item entitled “default position” that returns the cube to the default viewing position with the eye at 0,0,2 looking at the origin.