Exercise Solutions for Introduction to 3D Game Programming with DirectX 10

Similar documents
F F. proj cos( ) v. v proj v

Lecture 2: Vector-Vector Operations

Math 8 Winter 2010 Midterm 2 Review Problems Solutions - 1. xcos 6xdx = 4. = x2 4

Chapter 6 Additional Topics in Trigonometry, Part II

Dot Product August 2013

in Trigonometry Name Section 6.1 Law of Sines Important Vocabulary

Brief Review of Vector Algebra

10.2,3,4. Vectors in 3D, Dot products and Cross Products

MAT 1339-S14 Class 8

Linear Algebra. Alvin Lin. August December 2017

Worksheet 1.3: Introduction to the Dot and Cross Products

Study guide for Exam 1. by William H. Meeks III October 26, 2012

MATH 19520/51 Class 2

CHAPTER 5: Analytic Trigonometry

Worksheet 1.4: Geometry of the Dot and Cross Products

Brief Review of Exam Topics

MTH 2310, FALL Introduction

7.1 Projections and Components

MIDTERM 4 PART 1 (CHAPTERS 5 AND 6: ANALYTIC & MISC. TRIGONOMETRY) MATH 141 FALL 2018 KUNIYUKI 150 POINTS TOTAL: 47 FOR PART 1, AND 103 FOR PART

VECTORS IN 2-SPACE AND 3-SPACE GEOMETRIC VECTORS VECTORS OPERATIONS DOT PRODUCT; PROJECTIONS CROSS PRODUCT

Section 8.2 Vector Angles

v = v 1 2 +v 2 2. Two successive applications of this idea give the length of the vector v R 3 :

Math 32A Discussion Session Week 2 Notes October 10 and 12, 2017

Vectors. The standard geometric definition of vector is as something which has direction and magnitude but not position.

Dot Products. K. Behrend. April 3, Abstract A short review of some basic facts on the dot product. Projections. The spectral theorem.

Congruence Axioms. Data Required for Solving Oblique Triangles

94 CHAPTER 3. VECTORS AND THE GEOMETRY OF SPACE

Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach

Vectors and Matrices Lecture 2

Quantities which have only magnitude are called scalars. Quantities which have magnitude and direction are called vectors.

VECTORS IN THREE DIMENSIONS

Solutions to Selected Questions from Denis Sevee s Vector Geometry. (Updated )

Vector Operations. Lecture 19. Robb T. Koether. Hampden-Sydney College. Wed, Oct 7, 2015

The Cross Product of Two Vectors

Quiz 2 Practice Problems

Math 241, Exam 1 Information.

12.1 Three Dimensional Coordinate Systems (Review) Equation of a sphere

Last week we presented the following expression for the angles between two vectors u and v in R n ( ) θ = cos 1 u v

R n : The Cross Product

The Cross Product. Philippe B. Laval. Spring 2012 KSU. Philippe B. Laval (KSU) The Cross Product Spring /

6. Vectors. Given two points, P 0 = (x 0, y 0 ) and P 1 = (x 1, y 1 ), a vector can be drawn with its foot at P 0 and

MATH 12 CLASS 2 NOTES, SEP Contents. 2. Dot product: determining the angle between two vectors 2

Review of Coordinate Systems

PART 1: USING SCIENTIFIC CALCULATORS (50 PTS.)

2) If a=<2,-1> and b=<3,2>, what is a b and what is the angle between the vectors?

What you will learn today

6.1.1 Angle between Two Lines Intersection of Two lines Shortest Distance from a Point to a Line

Worksheet for Lecture 23 (due December 4) Section 6.1 Inner product, length, and orthogonality

Section 13.4 The Cross Product

Introduction. Law of Sines. Introduction. Introduction. Example 2. Example 1 11/18/2014. Precalculus 6.1

Linear Algebra: Homework 3

Designing Information Devices and Systems I Fall 2018 Lecture Notes Note 21

Course Notes Math 275 Boise State University. Shari Ultman

Squares on a Triangle

Math 2 Trigonometry. People often use the acronym SOHCAHTOA to help remember which is which. In the triangle below: = 15

Solution to Homework 1

Inner Product Spaces 6.1 Length and Dot Product in R n

CK- 12 Algebra II with Trigonometry Concepts 1

v = ( 2)

Answer Key. 7.1 Tangent Ratio. Chapter 7 Trigonometry. CK-12 Geometry Honors Concepts 1. Answers

The Cross Product. In this section, we will learn about: Cross products of vectors and their applications.

which has a check digit of 9. This is consistent with the first nine digits of the ISBN, since

BSc (Hons) in Computer Games Development. vi Calculate the components a, b and c of a non-zero vector that is orthogonal to

LB 220 Homework 2 (due Tuesday, 01/22/13)

9.1 VECTORS. A Geometric View of Vectors LEARNING OBJECTIVES. = a, b

(1) Recap of Differential Calculus and Integral Calculus (2) Preview of Calculus in three dimensional space (3) Tools for Calculus 3

Polar Form of a Complex Number (I)

Name: ID: Math 233 Exam 1. Page 1

DATE: MATH ANALYSIS 2 CHAPTER 12: VECTORS & DETERMINANTS

which are not all zero. The proof in the case where some vector other than combination of the other vectors in S is similar.

Inner products. Theorem (basic properties): Given vectors u, v, w in an inner product space V, and a scalar k, the following properties hold:

9.4 Polar Coordinates

Core Mathematics 2 Trigonometry

12.1. Cartesian Space

Lecture 3: Linear Algebra Review, Part II

Vector Geometry. Chapter 5

Practical Linear Algebra: A Geometry Toolbox

4.1 Distance and Length

Math 3c Solutions: Exam 1 Fall Graph by eliiminating the parameter; be sure to write the equation you get when you eliminate the parameter.

Math Vector Calculus II

Exercise 1a: Determine the dot product of each of the following pairs of vectors.

Prepared by: M. S. KumarSwamy, TGT(Maths) Page

9.1 VECTORS. A Geometric View of Vectors LEARNING OBJECTIVES. = a, b

Vectors in the Plane

Calculus 1 for AE (WI1421LR) Lecture 1: 12.3 The dot product 12.4 The cross product

Remark 3.2. The cross product only makes sense in R 3.

MTH 2032 SemesterII

Math The Dot Product

Analytic Trigonometry. Copyright Cengage Learning. All rights reserved.

y 2 . = x 1y 1 + x 2 y x + + x n y n 2 7 = 1(2) + 3(7) 5(4) = 3. x x = x x x2 n.

Vectors for Beginners

LECTURE 2: CROSS PRODUCTS, MULTILINEARITY, AND AREAS OF PARALLELOGRAMS

The Dot Product

Lecture 1.4: Inner products and orthogonality

Vectors and Plane Geometry

Chapter 6 Additional Topics in Trigonometry

CHAPTER 3 : VECTORS. Definition 3.1 A vector is a quantity that has both magnitude and direction.

Linear Algebra Homework and Study Guide

VECTORS. Given two vectors! and! we can express the law of vector addition geometrically. + = Fig. 1 Geometrical definition of vector addition

a b 0 a cos u, 0 u 180 :

Transcription:

Exercise Solutions for Introduction to 3D Game Programming with DirectX 10 Frank Luna, September 6, 009 Solutions to Part I Chapter 1 1. Let u = 1, and v = 3, 4. Perform the following computations and draw the vectors relative to a D coordinate system. a) u + v b) u v c) u + 1 v d) u + v a) 1, + 3, 4 = 1 + 3, + 4 = 4, b) 1, 3, 4 = 1, + 3, 4 = 1 3, + 4 =, 6 c) 1, + 1 3, 4 =, 4 + 3, = 7, d) 1, + 3, 4 =, 4 + 3, 4 = 1, 8. Let u = 1, 3, and v = 3, 4, 1. Perform the following computations. a) u + v b) u v c) 3u + v d) u + v a) 1, 3, + 3, 4, 1 = 1 + 3, 3 + 4, + 1 =, 1, 3 b) 1, 3, 3, 4, 1 = 1, 3, + 3, 4, 1 = 4, 7, 1 c) 3 1, 3, + 3, 4, 1 = 3, 9, 6 + 6, 8, = 3, 1, 8 d) 1, 3, + 3, 4, 1 =, 6, 4 + 3, 4,1 = 5, 10, 3

3. This exercise shows that vector algebra shares many of the nice properties of real numbers (this is not an exhaustive list). Assume u = u x, u y, u z, v = v x, v y, v z, and w = w x, w y, w z. Also assume that c and k are scalars. Prove the following vector properties. a) b) c) d) a) u + v = v + u (Commutative Property of Addition) b) u + v + w = u + v + w (Associative Property of Addition) c) ck u = c ku (Associative Property of Scalar Multiplication) d) k u + v = ku + kv (Distributive Property 1) e) u k + c = ku + cu (Distributive Property ) u + v = u x, u y, u z + v x, v y, v z = u x + v x, u y + v y, u z + v z = v x + u x, v y + u y, v z + u z = v x, v y, v z + u x, u y, u z = v + u u + v + w = u x, u y, u z + v x, v y, v z + w x, w y, w z = u x, u y, u z + v x + w x, v y + w y, v z + w z = u x + v x + w x, u y + v y + w y, u z + v z + w z = u x + v x + w x, u y + v y + w y, u z + v z + w z = u x + v x, u y + v y, u z + v z + w x, w y, w z = u x, u y, u z + v x, v y, v z + w x, w y, w z = u + v + w ck u = ck u x, u y, u z = ck u x, ck u y, ck u z = c ku x, c ku y, c ku z = c ku x, ku y, ku z = c ku k u + v = k u x, u y, u z + v x, v y, v z = k u x + v x, u y + v y, u z + v z

= k u x + v x, k u y + v y, k u z + v z = ku x + kv x, ku y + kv y, ku z + kv z = ku x, ku y, ku z + kv x, kv y, kv z = ku + kv e) u k + c = u x, u y, u z k + c = u x k + c, u y k + c, u z k + c = ku x + cu x, ku y + cu y, ku z + cu z = ku x, ku y, ku z + cu x, cu y, cu z = ku + cu 4. Solve the equation 1,, 3 x, 0, 4 = 1,, 3 for x. Use vector algebra to solve for x: 1,, 3 x, 0, 4 = 1,, 3, 4, 6 x +, 0, 4 =, 4, 6 x +, 0, 4 = 4, 8, 1 x = 6, 8, 8 x = 3, 4, 4 5. Let u = 1, 3, and v = 3, 4, 1. Normalize u and v. u = 1 + 3 + = 1 + 9 + 4 = 14 u = u u = 1 14, 3 14, 14 v = 3 + 4 + 1 = 9 + 16 + 1 = 6 v = v v = 3 6, 4 6, 1 6. Let k be a scalar and let u = u x, u y, u z. Prove that ku = k u. 6 ku = ku x + ku y + ku z = k u x + u y + u z = k u x + u y + u z = k u 7. Is the angle between u and v orthogonal, acute, or obtuse?

a) u = 1, 1, 1, v =, 3, 4 b) u = 1, 1, 0, v =,, 0 c) u = 1, 1, 1, v = 3, 1, 0 a) u v = 1 + 1 3 + 1 4 = 9 > 0 acute b) u v = 1 + 1 + 0 0 = 0 orthogonal c) u v = 1 3 + 1 1 + 1 0 = 4 < 0 obtuse 8. Let u = 1, 3, and v = 3, 4, 1. Find the angle θ between u and v. Using the equation u v = u v cos θ we have: u v 1 θ = cos u v 1 3 + 3 4 + 1 1 = cos 14 6 13 1 = cos 14 6 = 13.95 9. Let u = u x, u y, u z, v = v x, v y, v z, and w = w x, w y, w z. Also let c and k be scalars. Prove the following dot product properties. a) u v = v u b) u v + w = u v + u w c) k u v = ku v = u kv d) v v = v e) 0 v = 0 u v = u x, u y, u z v x, v y, v z = u x v x + u y v y + u z v z = v x, v y, v z u x, u y, u z = v u u v + w = u x, u y, u z v x + w x, v y + w y, v z + w z = u x v x + w x + u y v y + w y + u z v z + w z = u x v x + u x w x + u y v y + u y w y + u z v z + u z w z = u x v x + u y v y + u z + u x w x + u y w y + u z w z = u v + u w k u v = k u x v x + u y v y + u z v z = ku x v x + ku y v y + ku z v z

= ku v = u x kv x + u y kv y + u z kv z = u kv v v = v x v x + v y v y + v z v z = v x + v y + v z = v 0 v = 0v x + 0v y + 0v z = 0 10. Use the law of cosines (c = a + b ab cos θ, where a, b, and c are the lengths of the sides of a triangle and θ is the angle between sides a and b) to show u x v x + u y v y + u z v z = u v cos θ Hint: Consider Figure 1.9 and set c = u v, a = u and b = v, and use the dot product properties from the previous exercise. c = a + b ab cos θ u v = u + v u v cos θ u v u v = u u + v v u v cos θ u u u v + v v = u u + v v u v cos θ u v = u v cos θ 11. Let n =, 1. Decompose the vector g = 0, 9.8 into the sum of two orthogonal vectors, one parallel to n and the other orthogonal to n. Also, draw the vectors relative to a D coordinate system. g = proj n g = g n 9.8 n = n 5,1 = 1.96,1 = 3.9, 1.96 g = g g = 0, 9.8 3.9, 1.96 = 3.9, 7.84 1. Let u =, 1, 4 and v = 3, 4, 1. Find w = u v, and show w u = 0 and w v = 0. w = u v = u y v z u z v y, u z v x u x v z, u x v y u y v x

= 1 + 16, 1 +, 8 3 = 17, 14, 5 w u = 17 + 14 1 + 5 4 = 34 + 14 + 0 = 0 w v = 17 3 + 14 4 + 5 1 = 51 56 + 5 = 0 13. Let the following points define a triangle relative to some coordinate system: A = 0, 0, 0, B = 0, 1, 3, and C = 5, 1, 0. Find a vector orthogonal to this triangle. Hint: Find two vectors on two of the triangle s edges and use the cross product. u = B A = 0, 1, 3 v = C A = (5,1,0) n = u v = u y v z u z v y, u z v x u x v z, u x v y u y v x = 0 3, 15 0, 0 5 = ( 3, 15, 5) 14. Prove that u v = u v sin θ. Hint: Start with u v sin θ and use the trigonometric identity cos θ + sin θ = 1 sin θ = 1 cos θ; then apply Equation 1.4. To make the derivation simpler, we compute the following three formulas up front: u v = u x + u y + u z v x + v y + v z = u x v x + v y + v z + u y v x + v y + v z + u z v x + v y + v z = u x v x + u x v y + u x v z + u y v x + u y v y + u y v z + u z v x + u z v y + u z v z (1) u v = u x v x + u y v y + u z v z u x v x + u y v y + u z v z = u x v x u x v x + u y v y + u z v z + u y v y u x v x + u y v y + u z v z + u z v z u x v x + u y v y + u z v z = u x v x u x v x + u x v x u y v y + u x v x u z v z + u y v y u x v x + u y v y u y v y + u y v y u z v z + u z v z u x v x + u z v z u y v y + u z v z u z v z = u x v x + u x v x u y v y + u x v x u z v z + u y v y + u y v y u z v z + u z v z () u v u v = u x v y + u x v z + u y v x + u y v z + u z v x + u z v y u x v x u y v y u x v x u z v z u y v y u z v z (3)

= u y v z u y v y u z v z + u z v y + u z v x u x v x u z v z + u x v z + u x v y + u x v x u y v y + u y v x Now, u v sin θ = u v 1 cos θ = u v 1 = u v u v u v u v u v u v = u v u v And u v = u y v z u z v y, u z v x u x v z, u x v y u y v x = u y v z u z v y + u z v x u x v z + u x v y u y v x = u y v z u y v z u z v y + u z v y + u z v x u z v x u x v z + u x v z + u x v y u x v y u y v x + u y v x = u v u v Thus we obtain the desired result: u v = u v sin θ 15. Prove that u v gives the area of the parallelogram spanned by u and v; see Figure below. The area is the base times the height: A = v h

Using trigonometry, the height is given by h = u sin (θ). This, along with the application of Exercise 14, we can conclude: A = u v sin (θ) = u v 16. Give an example of 3D vectors u, v, and w such that u v w u v w. This shows the cross product is generally not associative. Hint: Consider combinations of the simple vectors i = 1, 0, 0, j = 0, 1, 0, and k = 0, 0, 1. Choose u = (1,1,0), v = i, and w = j. Then: But, u v w = 1,1,0 k = (1, 1,0) u v w = k j = i 17. Prove that the cross product of two nonzero parallel vectors results in the null vector; that is, u ku = 0. Hint: Just use the cross product definition. u ku = u y ku z u z ku y, u z ku x u x ku z, u x ku y u y ku x = ku y u z ku z u y, ku z u x ku x u z, ku x u y ku y u x = 0