您的当前位置:首页正文

山东大学计算机图形学2010试卷A(含答案)

2022-10-07 来源:欧得旅游网
…… … … … … … …名…姓… … … … … 密 … … 号…学… … 级… … … … 封 …业…专… … … … … … … 线 …院…学… … … … … … … ………… 山东大学 计算机图形学 课程试卷 A 09-10 学年 2 学期 题号 一 二 三 四 五 六 七 八 九 十 总分 总分人 5. Choose two OpenGL sentences from the follow four candidates to transform the 得分 camera from the original position to the destination position 得分 阅卷人 Part I. Multiple Choice Questions (5 points each) (Destnation Postion) glMatrixMode(GL_MODELVIEW) 1. In a synthetic camera model, which of the following is (are) correct?___d___ glLoadIdentity(); a) The image plane is behind the center of projection (COP). _________a_______ b) Specifications of the objects and the viewer are dependent. _________c_______ c) The image of an object is flipped relative to the object. a) glTranslatef(0.0, 0.0, -d); //d>0 d) The projectors meet at the center of projection (COP). b) glTranslatef(0.0, 0.0, d); //d>0 c) glRotatef(-90.0, 0.0, 1.0, 0.0); 2. Give an order of the following phases according to the rendering pipeline _cebda__ d) glRotatef(90.0, 0.0, 1.0, 0.0); a) Fragment Processor b) Clipper 6. Local lighting computes the color or shade of each object independently. So it can’t c) Vertex Processor deal with situations such as _______acd________ d) Rasterizer a) Some objects are blocked from the light. e) Primitive Assembler b) Real time illumination. c) Light can reflect from object to object. 3. Which phase (as listed above) does each of the following operations belong to? d) Some objects might be translucent. ___c__ To convert object representations from one coordinate system to another ___d__ To generate inside fragments for a polygon and calculate their colors 得分 阅卷人 ___b__ To determine which objects are within the view volume ___a__ To determine the color of the corresponding pixel in the frame buffer 4. Which of the following statements regarding affine transformations is(are) correct? Part II Free Form Questions (10 points each) glBegin (GL_TRIANGLE_STRIP) ____abd___ glVertex3fv(a); a) Two translations are commutative. glVertex3fv(b); b) Two rotations about the same axis are commutative. 1. Given the following code fragment: glVertex3fv(c); c) A scaling and a rotation are commutative glVertex3fv(d); d) A general rotation about an arbitrary line can be done with translations and rotations glVertex3fv(e); around the axes. glVertex3fv(b); glVertex3fv(f); glEnd ( ); 第 页 共 页 第 1 页 共 4 页

…… … … … … … …名…姓… … … … … 密 … … 号…学… … 级… … … … 封 …业…专… … … … … … … 线 …院…学… … … … … … … ………… 山东大学 计算机图形学 课程试卷 A 09-10 学年 2 学期 (1) Assume that the vertices of the first triangle in the above rendering of a mesh are 样就避免了在计算每个点的光照时计算r向量,减少了计算量 given in clockwise order. Please draw the mesh in the following space where a, b, c, d, 改进的phong光照模型: e, and f are the mentioned vertices. I=1/(a+bd+c*d^2)(Kd*Ld*Max(l*n,0)+Ks*Ls*Max((h*n)^alpha,0))+Ka*La a b 3. Answer the following questions. (1) What is the purpose of projection normalization? c d (2) How does the graphics system perform the normalization for an orthogonal projection f defined by glOrtho(left, right, bottom, top, near, far)? Give the steps and the final projection matrix. e (1)投影归一化时将视体统一为长宽高都为2,中心在原点的标准视体,这样使得同 样的流水线即可对平行视体进行操作,也可对透视视体进行操作,使处理过程得到(2) Why do we often prefer triangle strips and/or triangle fans to a group of separate 统一。同时也简化了裁减过程。 triangles in representation of the same 3D object? (2)平移T(-(right+left)/2,-(top+bottom)/2,(far+near)/2) 伸缩S(2/(right-left),2/(top-bottom),2/(far-near)) 如果全部用三角形图元绘制的话会有许多点被重复绘制。比较而言。Triangle strips 正交投影矩阵变换Mortho 与triangle fans 可以减少代码执行的代价与数据传输的代价 计算可得最终投影矩阵为: 2/(right-left) 0 0 -(right+left)/(right-left) 0 2/(top-bottom) 0 -(bottom+top)/(top-bottom) 0 0 2/(near-far) (far+near)/(far-near) 2. Answer the following questions. 0 0 0 1 (1) Give the equation for the Phong lighting model and explain the meaning of each term in it. (2) Describe the improvement the modified Phong model makes and give the modified lighting equation accordingly. 4. Answer the following questions. (1) (1) Briefly introduce the Bresenham’s algorithm for line segment rasterization. I=1/(a+bd+c*d^2)(Kd*Ld*Max(l*n,0)+Ks*Ls*Max((r*v)^alpha,0))+Ka*La (2) What is the advantage of the Bresenham’s algorithm over the DDA algorithm? L:此点指向光源的向量 Ld,Ls,La:分别为漫反射,镜面反射,环境光的光强 n:此点的法向量 Kd,Ks,Ka:分别为漫反射,镜面反射,环境光的反射系数 (1)设斜率m有0…… … … … … … …名…姓… … … … … 密 … … 号…学… … 级… … … … 封 …业…专… … … … … … … 线 …院…学… … … … … … … ………山东大学 计算机图形学 课程试卷 A 09-10 学年 2 学期 得分 阅卷人 (2)避免了大量的浮点运算,减少了计算量,提高了效率; 相对于未改进的DDA算法也避免了绘制直线不连续的情况。 Part III. OpenGL Application Questions (20 points) 1. The following code implements a robot arm. Please read it and answer the questions at the end. #include #include #define BASE_HEIGHT 0.2 5. Given the following 2D scene with 6 objects (a, b, d, e, f and g), we have added 5 #define BASE_WIDTH 0.2 partitioning planes (A, B, C, D and E) to construct a binary space partitioning (BSP) tree. #define LOWER_ARM_HEIGHT 0.5 Draw the BSP tree and explain how to use the BSP tree to render the scene. #define LOWER_ARM_WIDTH 0.05 #define UPPER_ARM_HEIGHT 0.5 #define UPPER_ARM_WIDTH 0.05 void base() { glPushMatrix(); glTranslatef(0.0, 0.5*BASE_HEIGHT, 0.0); glScalef(BASE_WIDTH, BASE_HEIGHT, BASE_WIDTH); glutSolidCube(1.0); // Cube-A A glPopMatrix(); } B C void upper_arm() g E D a { glPushMatrix(); d e b f glTranslatef(0.0, 0.5*UPPER_ARM_HEIGHT, 0.0); glScalef(UPPER_ARM_WIDTH,UPPER_ARM_HEIGHT, UPPER_ARM_WIDTH); 递归地判断视点和每一个树结点的位置关系,先画离视点远的一半空间,再画离视点较近 glutSolidCube(1.0); // Cube-B 的一半空间。所以,对于此例,顺序应该是 degabf glPopMatrix(); } 第 页 共 页 第 3 页 共 4 页

学院 专业 级 学号 姓名 山东大学 计算机图形学 课程试卷 A void lower_arm() { glPushMatrix(); glTranslatef(0.0, 0.5*LOWER_ARM_HEIGHT, 0.0); glScalef(LOWER_ARM_WIDTH,LOWER_ARM_HEIGHT,LOWER_ARM_WIDTH); glutSolidCube(1.0); // Cube-C glPopMatrix(); } void display(void) { GLfloat theta[] = {0.0, 45.0, 45.0}; glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glColor3f(1.0, 0.0, 0.0); glRotatef(theta[0], 0.0, 1.0, 0.0); base(); glColor3f(0.0, 1.0, 0.0); glTranslatef(0.0, BASE_HEIGHT, 0.0); glRotatef(theta[1], 0.0, 0.0, 1.0); lower_arm(); glColor3f(0.0, 0.0, 1.0); glTranslatef(0.0, LOWER_ARM_HEIGHT, 0.0); glRotatef(theta[2], 0.0, 0.0, 1.0); upper_arm(); glFlush(); glutSwapBuffers(); } 09-10 学年 2 学期 void main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(500, 500); glutCreateWindow(\"robot\"); glEnable(GL_DEPTH_TEST); glClearColor(1.0, 1.0, 1.0, 1.0); glutDisplayFunc(display); glutMainLoop(); } (1) What is the screen output of this program? Please illustrate with a picture. (2) If we can vary the values in the theta array freely, what spatial region can be reached by the tip of the upper arm? 一个中心点在 (0.0, 0.2, 0.0),半径为1的球体 (3) Write out the affine transformation matrix applied to each of Cube-A, Cube-B, and Cube-C. 对于Cube-A:Ry(0)*T(0,0.1,0)*S(0.2,0.2,0.2) 计算得为 0.2 0 0 0 0 0.2 0 0.1 0 0 0 2 0 0 0 1.0 第 页 共 页 第 4 页 共 4 页

…………山东大学 计算机图形学 课程试卷 A 09-10 学年 2 学期 … … … …名…姓… … … … … 密 … … 号…学… … 级… … … … 封 …业…专… … … … … … … 线 …院…学… … … … … … … ………… 对Cube-B:Ry(0)*T(0,0.2,0)R(z)(45)*T(0,0.5,0)*R(z)(45)*T(0,0.25,0)S(0.05,0.5,0.05) 计算得

0 -1/2 0 -(1+sqrt(2))/4 ½ 0 0 sqrt(2)/4+1/5 0 0 1/(20) 0 0 0 0 1

对于Cube-C:Ry(0)*T(0,0.2,0)*R(z)(45)*T(0,0.25,0)*S(0.05,0.5,0.05) 计算得

sqrt(2)/40 -sqrt(2)/40 0 -sqrt(2)/8 sqrt(2)/40 -sqrt(2)/40 0 sqrt(2)/8+1/5 0 0 1/20 0 0 0 0 1

第 页 共第 4 页 共 4 页页

因篇幅问题不能全部显示,请点此查看更多更全内容