developed into a useful operation by including the angle between the vectors. Figure 6.7 shows two vectors r and s that have been drawn, for convenience, such that their tails touch. Taking s as the reference vector, which is an arbitrary choice, we compute the projection of r on s, which takes into account their relative orientation. The length of r on s is ||r|| cos(β). We can now multiply the magnitude of s by the projected length of r : ||s||·||r|| cos(β). This scalar product is written s · r
s · r = ||s|| · ||r|| cos(β) (6.18) The dot symbol ‘·’ is used to represent scalar multiplication, to distinguish it from the vector product, which, we will discover, employs a ‘×’ symbol. Because of this symbol, the scalar product is often referred to as the dot product. So far we have only defined what we mean by the dot product. We now need to find out how to compute it. Fortunately, everything is in place to perform this task. To begin with, we define two Cartesian vectors r and s, and proceed to multiply them together using the dot product definition:


Before we proceed any further, we can see that we have created various dot product terms such as (i · i), (j · j), (k · k), etc. These terms can be divided into two groups: those that involve the same unit vector, and those that reference different unit vectors. Using the definition of the dot product, terms such as (i · i), (j · j) and (k · k) = 1, because the angle between i and i, j and j, or k and k is 0◦; and cos(0◦) = 1. But because the other vector combinations are separated by 90◦, and cos(90◦) = 0, all remaining terms collapse to zero. Bearing in mind that the magnitude of a unit vector is 1, we can write
||s|| · ||r|| cos(β) = ad + be + cf (6.22)
This result confirms that the dot product is indeed a scalar quantity. Now let’s see how it works in practice. 6.2.9 Example of the Dot Product To find the angle between two vectors r and s,

The angle between the two vectors is 62.1◦. It is worth pointing out at this stage that the angle returned by the dot product ranges between 0◦ and 180◦. This is because, as the angle between two vectors increases beyond 180◦, the returned angle β is always the smallest angle associated with the geometry.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
6.2.10 The Dot Product in Lighting Calculations Lambert’s law states that the intensity of illumination on a diffuse surface is proportional to the cosine of the angle between the surface normal vector and the light source direction. This arrangement is shown in Figure 6.8. The light source is located at (20, 20, 40) and the illuminated point is (0, 10, 0). In this situation we are interested in calculating cos(β), which when multiplied by the light source intensity gives the incident light intensity on the surface. To begin with, we are given the normal vector n to the surface. In this case n is a unit vector, and its magnitude

Therefore the light intensity at the point (0, 10, 0) is 0.218 of the original light intensity at (20, 20, 40). This does not take into account the attenuation due to the inverse-square law of light propagation.

Fig. 6.8. Lambert’s law states that the intensity of illumination on a diffuse surface is proportional to the cosine of the angle between the surface normal vector and the light source direction.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
6.2.11 The Dot Product in Back-Face Detection A standard way of identifying back-facing polygons relative to the virtual camera is to compute the angle between the polygon’s surface normal and the line of sight between the camera and the polygon. If this angle is less than 90◦ the polygon is visible; if it is equal to or greater than 90◦ the polygon is invisible. This geometry is shown in Figure 6.9. Although it is obvious from Figure 6.9 that the right-hand polygon is invisible to the camera, let’s prove algebraically that this is so. Let the camera be located at (0,0,0) and the polygon’s vertex is (10, 10, 40). The normal vector is [5 5 − 2]T

Fig. 6.9. The angle between the surface normal and the camera’s line of sight determines the polygon’s visibility.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
6.2.12 The Vector Product As mentioned above, there are two ways to obtain the product of two vectors. The first is the scalar product, and the second is the vector product, which is also called the cross product because of the ‘×’ symbol used in its notation. It is based on the definition that two vectors r and s can be multiplied together to produce a third vector t: r × s = t (6.23) where ||t|| = ||r|| · ||s||sin(β), and β is the angle between r and s. We will discover that the vector t is normal (90◦) to the plane containing the vectors r and s. This makes it an ideal way of computing the surface normal to a polygon. Once again, let’s define two vectors and proceed to multiply them together:

As we found with the dot product, there are two groups of vector terms: those that reference the same unit vector, and those that reference two different unit vectors. Using the definition for the cross product, operations such as (i×i), (j×j) and (k × k) result in a vector whose magnitude is 0. This is because the angle between the vectors is 0◦, and sin(0◦) = 0. Consequently these terms disappear and we are left with

The mathematician Sir William Rowan Hamilton struggled for many years when working on quaternions to resolve the meaning of the above result. What did the products mean? He assumed that i×j = k,j×k = i and k×i = j, but he also thought that j × i = k, k × j = i and i × k = j. But this did not work! One day in 1843, when he was out walking, thinking about this problem, he thought the impossible: i × j = k, but j × i = −k,j × k = i, but k × j = −i, and k×i = j, but i×k = −j. To his surprise, this worked, but it contradicted the commutative multiplication law of scalars where 6 × 7=7 × 6. We now accept that vectors do not obey all the rules of scalars, which is an interesting result. Proceeding, then, with Hamilton’s rules, we reduce the cross product terms of (6.27) to

We now modify the middle term to create a symmetric result:

If this is written in determinant form we get

where the determinants provide the scalar for each unit vector. We will discover later that the determinant of a 2 × 2 matrix is the difference between the products of the diagonal terms.
Although it may not be obvious, there is a simple elegance to this result,
which enables the cross product to be calculated very quickly. To derive the cross product we write the vectors in the correct sequence. Remember that
r × s does not equal s × r. First take r × s:
The scalar multiplier for i is (bf − ec). This is found by ignoring the i components and looking at the scalar multipliers of j and k.
The scalar multiplier for −j is (af − dc). This is found by ignoring the j components and looking at the i and k scalars.
The scalar multiplier for k is (ae − db). This is found by ignoring the k components and looking at the i and j scalars.
Let’s illustrate this with some examples. First we confirm that the vector product works with the unit vectors, i, j and k.
Therefore

Let’s now consider two vectors r and s and compute the normal vector t.
The vectors will be chosen so that we can anticipate approximately the answer.
Figure 6.10 shows the vectors r and s and the normal vector t. Table 6.2
contains the coordinates of the vertices forming the two vectors.

This confirms what we expected from Figure 6.10. Let’s now reverse the vectors
to illustrate the importance of vector sequence:


s × r = (0 × 0 − 1 × 1)i − (−1 × 0 − (−1) × 1)j
+(−1 × 1 − (−1) × 0)k
= −i − j − k
which is in the opposite direction to r × s.
s · r = ||s|| · ||r|| cos(β) (6.18) The dot symbol ‘·’ is used to represent scalar multiplication, to distinguish it from the vector product, which, we will discover, employs a ‘×’ symbol. Because of this symbol, the scalar product is often referred to as the dot product. So far we have only defined what we mean by the dot product. We now need to find out how to compute it. Fortunately, everything is in place to perform this task. To begin with, we define two Cartesian vectors r and s, and proceed to multiply them together using the dot product definition:
Before we proceed any further, we can see that we have created various dot product terms such as (i · i), (j · j), (k · k), etc. These terms can be divided into two groups: those that involve the same unit vector, and those that reference different unit vectors. Using the definition of the dot product, terms such as (i · i), (j · j) and (k · k) = 1, because the angle between i and i, j and j, or k and k is 0◦; and cos(0◦) = 1. But because the other vector combinations are separated by 90◦, and cos(90◦) = 0, all remaining terms collapse to zero. Bearing in mind that the magnitude of a unit vector is 1, we can write
||s|| · ||r|| cos(β) = ad + be + cf (6.22)
This result confirms that the dot product is indeed a scalar quantity. Now let’s see how it works in practice. 6.2.9 Example of the Dot Product To find the angle between two vectors r and s,
The angle between the two vectors is 62.1◦. It is worth pointing out at this stage that the angle returned by the dot product ranges between 0◦ and 180◦. This is because, as the angle between two vectors increases beyond 180◦, the returned angle β is always the smallest angle associated with the geometry.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
6.2.10 The Dot Product in Lighting Calculations Lambert’s law states that the intensity of illumination on a diffuse surface is proportional to the cosine of the angle between the surface normal vector and the light source direction. This arrangement is shown in Figure 6.8. The light source is located at (20, 20, 40) and the illuminated point is (0, 10, 0). In this situation we are interested in calculating cos(β), which when multiplied by the light source intensity gives the incident light intensity on the surface. To begin with, we are given the normal vector n to the surface. In this case n is a unit vector, and its magnitude
Therefore the light intensity at the point (0, 10, 0) is 0.218 of the original light intensity at (20, 20, 40). This does not take into account the attenuation due to the inverse-square law of light propagation.
Fig. 6.8. Lambert’s law states that the intensity of illumination on a diffuse surface is proportional to the cosine of the angle between the surface normal vector and the light source direction.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
6.2.11 The Dot Product in Back-Face Detection A standard way of identifying back-facing polygons relative to the virtual camera is to compute the angle between the polygon’s surface normal and the line of sight between the camera and the polygon. If this angle is less than 90◦ the polygon is visible; if it is equal to or greater than 90◦ the polygon is invisible. This geometry is shown in Figure 6.9. Although it is obvious from Figure 6.9 that the right-hand polygon is invisible to the camera, let’s prove algebraically that this is so. Let the camera be located at (0,0,0) and the polygon’s vertex is (10, 10, 40). The normal vector is [5 5 − 2]T
Fig. 6.9. The angle between the surface normal and the camera’s line of sight determines the polygon’s visibility.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
6.2.12 The Vector Product As mentioned above, there are two ways to obtain the product of two vectors. The first is the scalar product, and the second is the vector product, which is also called the cross product because of the ‘×’ symbol used in its notation. It is based on the definition that two vectors r and s can be multiplied together to produce a third vector t: r × s = t (6.23) where ||t|| = ||r|| · ||s||sin(β), and β is the angle between r and s. We will discover that the vector t is normal (90◦) to the plane containing the vectors r and s. This makes it an ideal way of computing the surface normal to a polygon. Once again, let’s define two vectors and proceed to multiply them together:
As we found with the dot product, there are two groups of vector terms: those that reference the same unit vector, and those that reference two different unit vectors. Using the definition for the cross product, operations such as (i×i), (j×j) and (k × k) result in a vector whose magnitude is 0. This is because the angle between the vectors is 0◦, and sin(0◦) = 0. Consequently these terms disappear and we are left with
The mathematician Sir William Rowan Hamilton struggled for many years when working on quaternions to resolve the meaning of the above result. What did the products mean? He assumed that i×j = k,j×k = i and k×i = j, but he also thought that j × i = k, k × j = i and i × k = j. But this did not work! One day in 1843, when he was out walking, thinking about this problem, he thought the impossible: i × j = k, but j × i = −k,j × k = i, but k × j = −i, and k×i = j, but i×k = −j. To his surprise, this worked, but it contradicted the commutative multiplication law of scalars where 6 × 7=7 × 6. We now accept that vectors do not obey all the rules of scalars, which is an interesting result. Proceeding, then, with Hamilton’s rules, we reduce the cross product terms of (6.27) to
We now modify the middle term to create a symmetric result:
If this is written in determinant form we get
where the determinants provide the scalar for each unit vector. We will discover later that the determinant of a 2 × 2 matrix is the difference between the products of the diagonal terms.
Although it may not be obvious, there is a simple elegance to this result,
which enables the cross product to be calculated very quickly. To derive the cross product we write the vectors in the correct sequence. Remember that
r × s does not equal s × r. First take r × s:
The scalar multiplier for i is (bf − ec). This is found by ignoring the i components and looking at the scalar multipliers of j and k.
The scalar multiplier for −j is (af − dc). This is found by ignoring the j components and looking at the i and k scalars.
The scalar multiplier for k is (ae − db). This is found by ignoring the k components and looking at the i and j scalars.
Let’s illustrate this with some examples. First we confirm that the vector product works with the unit vectors, i, j and k.
Therefore
Let’s now consider two vectors r and s and compute the normal vector t.
The vectors will be chosen so that we can anticipate approximately the answer.
Figure 6.10 shows the vectors r and s and the normal vector t. Table 6.2
contains the coordinates of the vertices forming the two vectors.
This confirms what we expected from Figure 6.10. Let’s now reverse the vectors
to illustrate the importance of vector sequence:
s × r = (0 × 0 − 1 × 1)i − (−1 × 0 − (−1) × 1)j
+(−1 × 1 − (−1) × 0)k
= −i − j − k
which is in the opposite direction to r × s.
No comments
Post a Comment