Question: 04 Supposed a 2-dimensional clipping window has its lower left corner at A (20, 20) and its upper right corner at C(90, 90). There are
04 Supposed a 2-dimensional clipping window has its lower left corner at A (20, 20) and its upper right corner at C(90, 90). There are 2 lines P.P2 with P: (10,15) P2 (80, 80) and PMPs with P: (30,95) in the window. By using Cohen-Sutherland line clipping algorithm, (a) find the region codes for the endpoints P1 P2 and Ps. (6 marks) (b) calculate the new endpoints P' and '. (10 marks) (c) draw the output that will be displayed in the window. (4 marks) 05 Given below is an OpenGL code to generate a square. glBegin (GL_QUADS); glVertex2i(50,50); glvertex2 i (100,50): glvertex2i (100,100); glvertex2i(50,100); g1 End(); (a) By using the homogeneous coordinate, write the individual transformation matrices to implement the following transformation glRotatef (45.0f, 0.0, 0.0, 1.0); giScalef (0.5, 0.5, 1.0f); glTranslatef (100.0f, 0.0f, 0.0); (6 marks) (b) Calculate the new position of the square if it were subjected to transformations in Q4 (a). (8 marks) (c) Sketch an output display of the square at it's initial position and after performing the transformation. (4 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
