[圖形學(xué)]3D數(shù)學(xué)基礎(chǔ) 圖形與游戲開發(fā)(習(xí)題答案)
《[圖形學(xué)]3D數(shù)學(xué)基礎(chǔ) 圖形與游戲開發(fā)(習(xí)題答案)》由會(huì)員分享,可在線閱讀,更多相關(guān)《[圖形學(xué)]3D數(shù)學(xué)基礎(chǔ) 圖形與游戲開發(fā)(習(xí)題答案)(31頁珍藏版)》請?jiān)谘b配圖網(wǎng)上搜索。
1、 1 Answers Chapter 2 1) Give the coordinates of the following points: a (-2.5, 3) b (1, 2) c (2.5, 2) d (-1, 1) e (0, 0) f (2, -0.5) g (-0.5, -1.5) h (0, -2) j (-3, -2) 2 2) List the 48 different possible ways that the 3D axes may be assigned to the directions “north,” “east” and “up.” Iden
2、tify which of these combinations are left-handed, and which are right-handed. North East Up Hand North East Up Hand +x +y +z Left +x +z +y Right +x +y –z Right +x +z –y Left +x –y +z Right +x –z +y Left +x –y –z Left +x –z –y Right –x +y +z Right –x +z +y Left –x +y –z Left –x +z –y Right –x –y +z
3、Left –x –z +y Right –x –y –z Right –x –z –y Left +y +x +z Right +y +z +x Left +y +x –z Left +y +z –x Right +y –x +z Left +y –z +x Right +y –x –z Right +y –z –x Left –y +x +z Left –y +z +x Right –y +x –z Right –y +z –x Left –y –x +z Right –y –z +x Left –y –x –z Left –y –z –x Right +z +x +y Left +z +y
4、 +x Right +z +x –y Right +z +y –x Left +z –x +y Right +z –y +x Left +z –x –y Left +z –y –x Right –z +x +y Right –z +y +x Left –z +x –y Left –z +y –x Right –z –x +y Left –z –y +x Right –z –x –y Right –z –y –x Left 3) In a popular modeling program 3D Studio Max, the default orientation of the axes is
5、for +x to point right, +y to point forward, and +z to point up. Is this a left- or right- handed coordinate space? Right-handed. Chapter 3 1) Draw a nested space hierarchy tree for the sheep described in Section 3.3, assuming that its head, ears, upper legs, lower legs, and body move indemenden
6、tly. 2) Suppose our object axes are transformed to world axes by rotating them counterclockwise around the y-axis by 42 and then translating six units along the z- axis and 12 units along the x-axis. Describe this transformation from the perspective of the object. Imagine a point on the object, in
7、object space. As the axes are rotating counterclockwise, the point is actually rotating counterclockwise relative to the axes. Then, as the axes translate by [12, 0, 6], the point translates [-12, 0, -6] relative to the axes. 3) Which coordinate space is the most appropriate in which to ask the fol
8、lowing questions? a) Is my computer in front of or behind me? Object space. If we know the position of the computer within our object space, this question is a trivial matter of checking for a positive z value. (Assuming the conventions from Section 2.3.4) b) Is the book east or west of me? Inertial
9、 space is the easiest space to make this test. Again, assuming the conventions from Section 2.3.4, the book is east of us if the x-coordinate of the book’s position in our inertial space is positive, and west if this value is negative. Alternatively, we could answer the question in world space, by c
10、omparing the x-coordinate of the book in world space, with our own world space x-coordinate. c) How do I get from one room to the other? Pathfinding-type querries are usually made in world space. 4 d) Can I see my computer? The “camera space” for our viewpoint is the most natural coordinate space
11、 to use for this question. Chapter 4 1) Let: a) Identify a, b, and c, as row or column vectors, and give the dimension of each vector. a is a 2D row vector. b is a 3D column vector. c is a 4D column vector. b) Compute b y +c w +a x +b z . 2) Identity the quantities in each of the following sentenc
12、es as scalar or vector. For vector quantities, give the magnitude and direction. (Note: some directions may be implicit.) a) How much do you weigh? Weight is a calar quantity. b) Do you have any idea how fast you were going? Speed is a scalar quantity. c) It’s two blocks north of here. “Two blocks n
13、orth” is a vector quantity, since it specified a magnitude (“two blocks”) and a direction (“north”). d) We’re cruising from Los Angeles to New York at 600mph, at an altitude of 33,000ft. Speed (600mph) is a scalar quantity. However, since we know we are traveling from Los Angeles to New York, we cou
14、ld assume an eastward direction, which would provide a direction, making it a velocity, which is a vector quantity. Altitude (33,000ft) is a scalar quantity. 3) Give the values of the following vectors: 4) Identify the following statements as true or false. If the statement is false, explain
15、 why. a) The size of a vector in a diagram doesn’t matter; we just need to draw it in the right place. False. Size matters; so does direction. A vector does not express a “position,” and so we can draw in on a diagram anywhere that is convenient. See Section 4.2.2. b) The displacement expressed by a
16、 vector can be visualized as a sequence of axially aligned displacements. True. See Figure 4.5 on page 40. c) These axially aligned displacements from the previous question must occur in order. False. They can occur in any order, due to commutative nature of vector addition. See page 40. d) The vect
17、or [x, y] gives the displacement from the point (x, y) to the origin. False. It gives the opposite displacement – from the origin to the point. a [0, 2] b [0, -2] c [0.5, 2] d [0.5, 2] e [0.5, -3] f [-2, 0] g [-2, 1] h [2.5, 2] j [6, 1] 6 Chapter 5 1) Evaluate the following vector expressions: a
18、) b) c) d) e) 2) Normalize the following vectors: a) b) 3) Evaluate the following vector expressions: a) b) 8 4) Compute the distance between the following pairs of points: a) b) 5) Evaluate the following vector expressions: a) Note: Although the above problem is va
19、lid, the notation isn’t the same as the notation used in the book. That’s because it contained a typo. The problem should have read: b) 6) Compute the angle between the vectors [1, 2] and [-6, 3]. From Section 5.10.2, we solve for the angle using the dot product: 10 7) Given
20、 the two vectors Separate v into components that are perpendicular and parallel to n. (n is a unit vector.) See Section 5.10.3. 8) Compute the value of 9) A man is boarding a plane. The airline has a rule where no carry-on item may be more than 2ft long, 2ft wide, or 2ft tall. He has a very v
21、aluable sword that is three feet long. He is able to carry the sword on board with him. How is he able to do this? What is the longest possible item that he could carry on? The man is able to board the plane by placing his sword diagonally in a cube-shaped box that is 2ft long, 2ft tall, and 2ft wid
22、e. The length of the longest item he could carry is: which is about 41.5 inches. (Of course, nowadays, he would be arrested and would not be allowed to board the plane at all! This question was written before the recent increase airport security.) 10) Verify Figure 5.7 on page 56 mathematically. 1
23、1) Is the coordinate system used in Figure 5.13 on page 63 a left-handed or right- handed coordinate system? Left-handed. 12) Assume that Texas is flat. A minute of latitude is approximately 1.15 miles in length. At the authors’ latitude (see section 3.2.1), a minute of longitude is approximately 0.
24、97 miles in length. There are 60 minutes in one degree of latitude or longitude. How far apart are the authors? First, we need to convert degrees and minutes to miles. The latitudinal and longitudinal distances are: Now, we apply the 2D distance formula (Equation 5.12): 12 Chapter 7 1) Given t
25、he following matrices: a) For each matrix A through F above, give the dimensions of the matrix and identify the matrix as square and/or diagonal. Matrix Dimensions Square Diagonal A 43 No No B 22 Yes Yes C 22 Yes No D 13 No No E 52 No No F 41 No No b) Determine if the following matri
26、x multiplications are allowed, and if so, give the dimensions of the resulting matrix. Product Dimensions DA Undefined AD Undefined BC 22 AF Undefined E T B Undefined DFA Undefined c) Compute the following transpositions: 2) Compute the following products: a) 14 b) 3) Manipulate the followi
27、ng matrix product to remove the parenthesis: 4) What type of transformation is represented by the following 2D matrix: Extracting the basis vectors [0,-1] and [1,0] and drawing them on a coordinate grid, we see that the transformation matrix performs a clockwise rotation about the origin by 90 deg
28、rees. Chapter 8 1) Construct a matrix to rotate -22? about the x-axis. Using Equation 8.2 on page 108: 2) Construct a matrix to rotate 30? about the y-axis. Using Equation 8.3 on page 108: 3) Construct a matrix that transforms a vector from inertial space to object space. From the “identity
29、orientation,” the object rotated 30? around its y-axis and then -22? about its x-axis. This is a trick question, intended to make you think about exactly what happens when a vector is rotated from inertial to object space. The most tempting error is to just take the two matrices from the previous se
30、ctions and concatenate them in order. But let’s think about exactly what is happening. Remember that when we transform a vector from one coordinate space to another, the vector doesn’t actually move, we are just expressing it a different coordinate space. So let’s imagine the coordinate space itsel
31、f rotating with the object from inertial to object space. First, the object (and its coordinate space) rotated 30? around the y-axis. Now, as the coordinate space rotates positive 30?, a vector would rotate negative 30? (relative to the coordinate space – remember, the vector is actually stationary)
32、. Likewise, when the object (and the coordinate space) rotates -22? about the x-axis, a vector will rotate positive 22? (relative to the coordinate space). Now the coordinate space is in line with object space, and our vector is expressed in object space. 16 4) Express the object’s z-axis using
33、inertial coordinates. The object’s z-axis in object space is trivially [ 0, 0, 1 ]. Our task is to transform this vector into inertial space. To do this, we will construct the object-to-inertial matrix. This is the opposite of the inertial-to-object matrix. Recall from the previous exercise that th
34、e inertial-to-object matrix first rotates about the y-axis by -30? and then about the x-axis by 22?. The object-to-inertial matrix will do the opposite: we will first rotate about the x-axis by -22?, and then about the y-axis by 30?. We can get the values for the matrix from the first two exercises.
35、 Notice that the object-to-inertial matrix is the transpose of the inertial-to-object matrix that we computed in the previous exercise. Also, notice that the rotation matrices that rotate about a single axes are the transpose of the corresponding matrices that rotate about the same axis by the
36、opposite rotation angle. Any rotation matrix is “orthogonal,” which means that the inverse matrix (the matrix which does the “opposite” rotation) is obtained simply by transposing the matrix. Matrix inversion and orthogonal matrices are discussed in detail Sections 9.2 and 9.3. Now that we have the
37、object-to-inertial matrix, we can compute the unit vector corresponding to the z-axis, by transforming the vector [ 0, 0, 1 ] from object to inertial space: 5) Construct a matrix to rotate 164? about the z-axis. Using Equation 8.4 on page 109: 6) Construct a matrix to rotate -5? about the axis [99
38、, -99, 99]. We will use Equation 8.5 on page 111. However, this requires that our axis of rotation, n, be a unit vector. So we first normalize the vector [ 99, -99, 99 ] to calculate n. Now we can apply Equation 8.5 directly: 18 7) Construct a matrix that doubles the height, width, and length o
39、f an object. Using Equation 8.7 from page 113: 8) Construct a matrix to scale by a factor of 5 about the plane through the origin perpendicular to the vector [99, -99, 99]. We will use Equation 8.9 from page 115, which requires that our perpendicular vector, n, be normalized. We computed this unit
40、vector in exercise 6. 9) Construct a matrix to orthographically project onto the plane through the origin perpendicular to the vector [99, -99, 99]. We apply Equation 8.16 from page 117. 10) Construct a matrix to reflect orthographically about the plane through the origin perpendicular to the
41、vector [99, -99, 99]. We apply Equation 8.18 from page 118. The vector [-99, 99, -99]? This is a trick question. The plane perpendicular to this vector is the same plane that is perpendicular to the vector [99, -99, 99], since the two vectors are negatives of each other. Thus, the same matrix can b
42、e used to reflect about the plane. If you examine the matrices for scale, projection, and reflection, (Equations 8.9, 8.16, and 8.18, respectively), you will see that in each case, negating n results in no change to the matrix. 11) Does the matrix below express a linear transformation? Affine? 20
43、 Another trick question. The transformation is both linear and affine. From Section 8.8.1, we know that any matrix represents a linear transformation. From Section 8.8.2, we know that any linear transformation is an affine transformations. Chapter 9 1) Compute the determinant of the following matri
44、x: We use Equation 9.1 from page 125. 2) Compute the determinant, adjoint, and inverse of the following matrix: The determinant is given by Equation 9.2 from page 126. To compute the classical adjoint, we first compute the cofactors of M. (See Section 9.2.1.) Now the adjoint is the transpos
45、e of the matrix of cofactors: To compute the inverse, we divide the classical adjoint by the determinant. (Equation 9.7 on page 131.) 3) Is the following matrix orthogonal? We can use the ideas from Section 9.3.2 to test the matrix to see if it is orthogonal. The matrix is not orthogonal. The 2
46、 nd , 3 rd , and 7 th sums should be zero, and the 4 th sum should be one. 22 Unfortunately, the matrix was intended to be orthogonal! There was a typo in the exercise, element m 13 was missing a minus sign and should have been –0.9685. With that correction, we compute the nine equations again:
47、 This time, we see that the nine sums are close enough (within tolerance of the precision that we used in the original matrix) to consider the matrix orthogonal. I apologize for this error. 4) Invert the matrix from the previous exercise. If you took the time to invert the matrix with the typo, the
48、n kudos to you! I hope you got this answer: The intent of the exercise was not to make you grind through a bunch of math, but for you to realize that since the matrix is orthogonal, the inverse is simply the transpose: 5) Invert the 4x4 matrix: The typo from the previous problem propogated i
49、nto this exercise. Luckily, it doesn’t really make the problem any more complicated, since the point of this exercise is not really to go through the work of inverting a 4x4 matrix, but to realize that you can use most of your results from the previous exercise. Recall from Section 9.4.2 (see page 1
50、38) that when the righthand column of a 4x4 matrix is [ 0, 0, 0, 1 ] T , we can separate the matrix into a 3D linear transform matrix R, and a translation matrix T. Let M be the matrix above (the one from the book, with the typo). Then we have: By breaking M into its component parts like this, we h
51、ave found a shortcut for computing the inverse of M. Recall from 9.2.1 (page 131) that the inverse of a matrix product is the product of the inverses taken in reverse order: Since T is a translation matrix, T -1 is simply the matrix which translates by the opposite amount. R -1 comes from the previ
52、ous exercise. The matrix multiplication is easy since there are so many 1’s and 0’s: 24 6) Construct a 4x4 matrix to translate by [4,2,3]. See Equation 9.10 on page 137. 7) Construct a 4x4 matrix to rotate 20? about the x-axis and then translate by [4,2,3]. The upper 3x3 portion of the rotation
53、 matrix is constructed using Equation 8.2 on page 108. Concatenating this with our matrix from the previous exercise, we get: 8) Construct a 4x4 matrix to translate by [4,2,3] and then rotate 20? about the x-axis. We use the same matrices from Exercise 7, only we concatenate them in the opposi
54、te order. Notice that only the last row is effected. 9) Construct a 4x4 matrix to perform a perspective projection onto the plane x=5. (Assume the origin is the center of projection.) Equation 9.13, which gives a matrix to project onto the plane z=d, was presented in Section 9.4.6. We can apply th
55、e same basic principle to project onto a plane of constant x: 10) Use the matrix from the previous exercise to compute the 3D coordinates of the projection of the point (107, -243, 89) onto the plane x=5. First, we extend the point into 4D and compute the projected point in homegenous coordinates.
56、 26 Now we divide by the homegenous coordinate w to get the physical 3D coordinates: Chapter 10 1) Construct a quaternion to rotate 30? about the x-axis. Using Equation 10.4 on page 162: What is the magnitude of this quaternion? Since we know the quaternion is a valid rotation quaternion, it is
57、 a unit quaternion and therefore the magnitude is one. However, we can verify this using Equation 10.6 from page 163. What is its conjugate? As per Equation 10.7 on page 164, to obtain the quatnion conjugate, we negate the vector portion: What type of rotation is expressed by the conjugate? In
58、 Section 10.4.7 we learned that the quaternion conjugate represents the opposite rotation as the original quaternion. Since the original quaternion rotates 30? about the x-axis, the conjugate rotates negative 30? about the x-axis. In the next exercise, we show how to extract the angle and axis of ro
59、tation manually. 2) What type of rotation is represented by the quaternion: We apply Equation 10.4 from page 162 in reverse. First, we extract the angle of rotation, θ, from the w component of the quaternion: Now that we have the angle of rotation, we can solve for the axis of rotation, n: The ac
60、tual result is closer to [ .57735, -.57735, .57735 ]. Because we were using only three decimal digits, the floating point error has accumulated. (In fact, the angle of rotation was actually 30 degrees, but the limited precision caused large roundoff errors, due to the inverse trig functions, which a
61、re highly non-linear.) Compute a quaternion which performs 1/5 th of this rotation. In Section 10.4.12, we learned about quaternion exponentiation, which is used to compute a quaternion which represents a “fraction” of the rotation of a given quaternion. Officially, this uses the quaternion exp and
62、log operations, as shown in Equation 10.18. However, as we mentioned in that same section, the quaternion log and exp operations are nice mathematical formalities, but in practice, the quaternion 28 expoentiation is computed by extracting the rotation angle and axis, taking the desired fraction o
63、f the rotation angle, and then computing a new quaternion. This technique is illustrated in code in Listing 10.1. Now we’ll apply it mathematically in an example. (We’ll use the more precise values.) 3) Consider the quaternions. Compute the dot product ab. Using Equation 10.14 on page 169: Comput
64、e the difference from a to b See Section 10.4.9 Compute the quaternion product ab. Using Equation 10.13 on page 168. 4) Convert the quaternion in exercise 2 to matrix form. Here’s the quaternion from exercise 2: 30 We can convert this quaternion to a matrix in two different ways. The most
65、straightforward way is to apply Equation 10.23 (page 187) directly: 5) Write the C++ code to convert an object-to-inertial matrix to Euler angle form. Listing 10.3 (page 184) presented code to extract Euler angles from an inertial-to- object rotation matrix. From Section 9.3, we know that the objec
66、t-to-inertial matrix is the transpose of the inertial-to-object matrix. Thus, we can start with listing 10.3, and whenever a matrix element is referenced, replace that matrix element by the corresponding element in the transpose. This results in the following code snippet: // Assume the matrix is stored in these variables: float m11,m12,m13; float m21,m22,m23; float m31,m32,m33; // We will compute the Euler angle values in radians and store them here: float h,p,b; // Extract pitch from
- 溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 《筍芽兒》課件
- 高速鐵路同相供電
- 二年級語文下冊-第4單元-13《激光的話》課件4-語文S版
- 《一枚金幣》課件
- 1441單項(xiàng)式乘以多項(xiàng)式(課件)PPT
- 12分式的乘法和除法
- 常見蔬菜分類
- 保險(xiǎn)客戶經(jīng)營1361法則
- 現(xiàn)場目視管理與看板管理
- 高中政治-4.2文化在繼承中發(fā)展課件1-新人教版必修3PPT文檔
- 八年級生物上冊 181 微生物在生物圈中的作用(第2課時(shí))課件(2)(新版)北師大版
- 人生的夢想
- 動(dòng)物生理學(xué)-第六章課件
- IE經(jīng)典管理基礎(chǔ)
- AfternoonandEvening課件