
” CMPT 361编程 辅导、 写作PythonComputing Science CMPT 361 Fall 2020Assignment #1 (8 marks)Written parts are exercises, no submission; solutions posted progressively by Nov. 17.Programming part due: Tuesday, Nov. 17, 11:45 p.m. via electronic submission.Programming (8 marks): Tetris!You are to implement a simplified version of the game Tetris as described below. Anyvisual flare that you wish to add to the appearance of your game will be judged by thegrader and may be credited at his Discretion. The game window consists of a 20 10square grid of appropriate size, e.g., so that the window will fit in the screen comfortably.There are seven standard Tetris pieces (or tiles), as shown below, with pivot of rotationindicated by a black dot. You are advised to complete this problem in several steps.(a) [3 marks] Tile and grid rendering and tile downward movementSet up the game window with grid lines and randomly select Tetris tiles withdistinguishing colors one at a time and drop them from the top of the game window.The starting position and orientation of the tile is chosen randomly. You can controlthe speed of the tile movement to suit your game playing. Movement of the tileswill be aligned with the grids and at uniform speed. For this step, the tiles can dropstraight through the bottom. After one tile disappears, a new tile is dropped.(b) [1 marks] Tile stack-upIn this step, the tiles will stack up on top of each other and the bottom of the gamewindow will offer ground support, as in the Tetris game you are familiar with.(c) [3 marks] Key stroke interaction and tile movementsThe four arrow keys will be used to move the tiles. A pressing of the up keyrotates a tile counterclockwise about its pivot, 90 at a time. The left and rightkey presses result in lateral movements of a tile, one grid at a time. The down keyaccelerates the downward movement. At no time should you allow a tile piece tocollide with any existing Tetris pieces or the border of the game window.(d) [1 marks] Additional game logicWhen the bottom row is completely filled, it is removed and the tile stack above itwill be moved one row down. Game terminates when a new tile piece cannot be fitwithin the game window. Press q to quit and r to restart. Pressing any of thearrow keys should not slow down the downward movement of a tile.Note that the above steps build on top of each other, in order. You need not submitindividual programs to correspond to these steps. If you can implement all the requiredparts, a single, complete program is sufficient. No skeleton code is provided.Submission: All source codes and a README file that documents any steps notcompleted, additional features, and any extra instructions for your TA.Exercise 1: Why HD DVD failed?The so-called full HDTV mode supports a screen resolution of 1920 1080. Supposethat the video content is to be displayed at 30 Hz and that we wish to provide 24 bits ofcolor (8 bits per R, G, B). Then how many seconds of video of this type could fit on asingle-layer HD DVD, which Has a storage capacity of 15 Gigabytes? Does your answercontradict with common-sense? Should the demise of the HD DVD format against itsrival Blue-Ray be attributed to this? Offer an explanation.Exercise 2: Line drawingCompare the diamond exit rule and the Bresenhams algorithm. Specially, given two endpoints (x1, y1) and (x2, y2) with integer coordinates, will the pixels returned by the twoalgorithms, except for the two end pixels, be the same in general? Explain your answer.Exercise 3: Rigid-body transformationsLet us recall that the general form of a 3D transformation matrix M in homogeneouscoordinates isAssume that the upper 3 by 3 submatrix R of M is orthonormal, i.e., RT = R -1.1. What is the inverse of M? Note that you should not use brute force or a packagesuch as Maple or Matlab to answer this question.2. Prove that the transformation M preserves both lengths and angles in 3D. Notehere that when we talk about the angle between two vectors, the order in whichthe two vectors are given would be irrelevant.Exercise 4: gluLookAt()The GL utility (GLU) library had a function called gluLookAt which has the followingspecification:gluLookAt(ex, ey, ez, rx, ry, rz, ux, uy, uz)Write out the transformation matrix T which transforms points in the world coordinatesystem (WCS) into the view Coordinate system (VCS) specified by gluLookAt(). TheVCS has origin at the eye point (ex, ey, ez), and its positive z-axis is aligned with thevector v = (ex, ey, ez) (rx, ry, rz) . Also remember that the up vector (ux, uy, uz) is notnecessarily perpendicular to the vector v. You may leave your final answer as a productof two or more matrices.Exercise 5: Clipping with convex polygonsProve that clipping a convex polygon against another convex polygon will yield at mostone convex polygon.Exercise 6: BSP vs. depth-sortShow that the back-to-front display order determined by traversing a BSP tree is notnecessarily the same as the back-to-front order determined by depth-sort, even when nopolygons are split. To receive full mark on this problem, the number of polygons you usefor your example must be the smallest possible and you also need to prove that thenumber of polygons you used is the smallest possible. Hint: think about an example.Exercise 7: SilhouettesConsider a scene consisting of a set of closed convex objects represented by trianglemeshes and a viewpoint, device a simple method which returns the set of all silhouetteedges of the objects with respect to the viewpoint, assuming perspective projection. Provethat the set of edges returned will be forming a set of closed loops.Exercise 8: RadiosityExplain in what ways the radiosity method covered in class is designed to model globalillumination of a scene composed of Perfect diffuse reflectors.Exercise 9: Ray tracingExplain why the classical ray tracing algorithm, the one covered in class, it best suited torender glossy scenes, i.e., Scenes that are composed mostly of highly reflective andshinny surfaces? Can you propose a simply modification to that algorithm to also renderdull surfaces, i.e., surfaces that are diffuse rather than reflective?请加QQ:99515681 或邮箱:99515681@qq.com WX:codehelp
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。






