Game Development Reference
In-Depth Information
4.
(a) First, let's find the normal by using Equation (9.12):
2
4
3
5
2
4
3
5
2
4 −3
3
5
−1
17
6
1 −2
e 3 = p 2 −p 1 =
=
−11
19
,
2
4 −9
3
5
2
4
3
5
2
4 −12
3
5
−1
17
e 1 = p 3 −p 2 =
8
0
=
−17
,
2
4
3
5
2
4
3
5
2
4
3
5
(−11)(−17)−(19)(9)
(19)(−12)−(−3)(−17)
(−3)(9)−(−11)(−12)
187−171
−228−51
−27−132
16
−279
−159
e 3 ×e 1 =
=
=
.
Let's normalize it:
e 3 ×e 1 =
16 2 + (−279) 2 + (−159) 2 =
103378 ≈ 321.5,
16 −279 −159
e 3 ×e 1
e 3 ×e 1
n =
321.5
.04976 −.8677 −.4945
.
Just for kicks, we'll verify that we get the same result with Equation (9.13) from
Section 9.5.3:
n x = (z 1 + z 2 )(y 1 −y 2 ) + (z 2 + z 3 )(y 2 −y 3 ) + (z 3 + z 1 )(y 3 −y 1 )
= ((−2) + 17)(10−(−1)) + (17 + 0)((−1)−8) + (0 + (−2))(8−10)
= 16,
n y = (x 1 + x 2 )(z 1 −z 2 ) + (x 2 + x 3 )(z 2 −z 3 ) + (x 3 + x 1 )(z 3 −z 1 )
= (6 + 3)((−2)−17) + (3 + (−9))(17−0) + ((−9) + 6)(0−(−2))
= −279,
n z = (y 1 + y 2 )(x 1 −x 2 ) + (y 2 + y 3 )(x 2 −x 3 ) + (y 3 + y 1 )(x 3 −x 1 )
= (10 + (−1))(6−3) + ((−1) + 8)(3−(−9)) + (8 + 10)((−9)−6)
= −159,
.04976 −.8677 −0.4945
16 −279
159
16 −279
159
n =
.
321.5
16 2 + (−279) 2 + 159 2
Now that we have n, we can compute d. We'll arbitrarily use p 1 :
d = np 1
.04976 −.8677 −.4945
6
10 −2
≈ (.04976)(6) + (−.8677)(10) + (−.4945)(−2) ≈−7.389.
The plane equation for this triangle is
.04976x−.8677y −.4945z = −7.389.
Search WWH ::




Custom Search