Game Engine Architecture
4.2. Points and Vectors 139 Figure 4.3. A point represented in spherical coordinates. r θ φ Pr P Pθ Pφ Right-Handed z x y Left-H ...
140 4. 3D Math for Games It is easy to convert from LH to RH coordinates and vice-versa. We sim- ply fl ip the direction of any ...
4.2. Points and Vectors 141 called a position vector or radius vector. For our purposes, we can interpret any triple of scalars ...
142 4. 3D Math for Games a+ b b b a–b a Figure 4.6. Vector addition and subtraction. The scale factor can be diff erent along ...
4.2. Points and Vectors 143 a ax ay |a| Figure 4.7. Magnitude of a vector (shown in 2D for ease of illustration). whose componen ...
144 4. 3D Math for Games if we have the current position vector of an A.I. character P 1 , and a vector v representing her curre ...
4.2. Points and Vectors 145 Given an arbitrary vector v of length v = , we can convert it to a unit vector u that points in the ...
146 4. 3D Math for Games And the dot product combines with scalar multiplication as follows: Vector Projection If u is a unit ve ...
4.2. Points and Vectors 147 z Perpendicular. (a ⋅ b) = 0 (i.e., the angle between them is 90 degrees). z Same direction. (a ⋅ b) ...
148 4. 3D Math for Games The dot product can also be used to fi nd the height of a point above or below a plane (which might be ...
149 Direction of the Cross Product When using a right-handed coordinate system, you can use the right-hand rule to determine the ...
150 4. 3D Math for Games These three cross products defi ne the direction of positive rotations about the Cartesian axes. The po ...
4.3. Matrices 151 Geometrically, L = LERP(A, B, β) is the position vector of a point that lies β percent of the way along the li ...
152 4. 3D Math for Games or vectors to which it is applied. This is particularly useful in game program- ming, because we can pr ...
4.3. Matrices 153 z to multiply a 1 × n row vector by an n × n matrix, the vector must appear to the left of the matrix ( ), whe ...
154 4. 3D Math for Games Not all matrices have inverses. However, all affi ne matri- ces (combinations of pure rotations, transl ...
4.3. Matrices 155 It’s probably no surprise that rotations in three dimensions can be represented by a 3 × 3 matrix. The two-dim ...
156 4. 3D Math for Games 4.3.6.1. Transforming Direction Vectors Mathematically, points (position vectors) and direction vectors ...
4.3. Matrices 157 z the upper 3 × 3 matrix U, which represents the rotation and/or scale, z a 1 × 3 translation vector t, z a 3 ...
158 4. 3D Math for Games The matrix below represents rotation about the y-axis by an angle θ. Notice that this one is transposed ...
«
4
5
6
7
8
9
10
11
12
13
»
Free download pdf