Assignment 1

PART I: Written part (20%)

1) There is a cube drawn at the origin of the coordinate system oXYZ. We want to rotate the cube by 60 degrees clockwise around a specific vector U = P1P2, which originates from a point P1 (1,1,2) and passes through point P2 (2,2,3) in the space.

a) Suppose that through the above transformation, the homogeneous coordinates of any point p of the given cube are transformed to the target point p', and p' = M p where M is a 4x4 matrix. Specify what sub-matrices is M composed of, and compute the values of the entries of the 4x4 matrix M.(15 credits)

b) Write OpenGL code to represent the above transformation. Here we suppose that the cube is drawn at origin using the procedure DrawCube(). (5 credits)
(Hint: For the convenience of doing the programming of this part, you may directly modify the given code of cube.cpp, which uses glut library in OpenGL. Or you may use other OpenGL functions if you like.)
PART II: Programming Part (Hierarchical Modelling) (80%)

2.Suppose that you are given a cube model (P) with six faces as in the code cube.cpp we provide to you. Do the programming to obtain the first round of subdivision (Q) of the surface of the cube P using Doo-Sabin subdivision method.(20 credits)
(Hint: For the convenience of doing the programming of this part, you may directly modify the given code of cube.cpp, which uses glut library in OpenGL. Or you may use other OpenGL functions if you like.)

3.Do the programming to further subdivide the surface of Q, which is obtained from question 2 above, for another round so that you obtain the second round of subdivision (R) for the original cube P again using the Doo-Sabin subdivision method.
(30 credits)
(Hint: Same as the hint in Question 2 above.)

4.In this last question, you need to do the programming to create a windmill consisting of gray cylindrical stand with a gray sphere on its top, and three purple cubical blades sticking out of the sphere. And then you also need to make the three blades of the windmill rotate around continuously with every 5 seconds as one cycle.
(20 credits)
(Hint: For each blade, you may scale the cube shape to the shape of the blade.)

5.Report for Questions 2 to 4 in PART II:
A report needs to be submitted for Questions 2 to 4 in PART II, and it is required to include:
a)Explain the main steps you did in the programming for Questions 2 to 4 in PART II, respectively. If reasons are needed to be included for what you choose to do in your programming code in some specific way, kindly include those too.
b)The operation or command instructions in your programs for each of the questions 2 to 4 in PART II.
c)The screenshots of the output of each of questions 2 to 4 in PART II.(10 credits)

Submission instructions:
1.Submit the answer of PART I, the programming code with report for each question in PART II
2.Your program and source code need to be submitted. You need to upload the related files of your source code:
a)“.cpp”, “.h”, and other related files
b)For Question 4 in PART II, you need to submit a mp4 video clip of 20 seconds, which records the animation of the first 20 seconds produced by your program.
3.Moreover, you need to compress all your files to one zip file.

Plagiarism warning:
The report and code will be uploaded and checked by Turnitin, do not copy the code from any open source websites, or from the work of your classmates or other people.

• QQ：99515681
• 邮箱：99515681@qq.com
• 工作时间：8:00-23:00
• 微信：codinghelp