Graphics Reference
In-Depth Information
P
2
Y
s
P
1
r
P
0
X
Fig. 6.13.
The area of the triangle formed by the vectors
r
and
s
is half the magnitude
of their cross product.
The vectors
r
and
s
are computed as follows:
⎡
⎤
⎡
⎤
x
1
−
x
0
x
2
−
x
0
⎣
⎦
⎣
⎦
r
=
y
1
−
y
0
s
=
y
2
−
y
0
(6.35)
0
0
r
=(
x
1
−
x
0
)
i
+(
y
1
−
y
0
)
j
(6.36)
s
=(
x
2
−
x
0
)
i
+(
y
2
−
y
0
)
j
(6.37)
||
r
×
s
||
=(
x
1
−
x
0
)(
y
2
−
y
0
)
−
(
x
2
−
x
0
)(
y
1
−
y
0
)
=
x
1
(
y
2
−
y
0
)
−
x
0
(
y
2
−
y
0
)
−
x
2
(
y
1
−
y
0
)+
x
0
(
y
1
−
y
0
)
=
x
1
y
2
−
x
1
y
0
−
x
0
y
2
−
x
0
y
0
−
x
2
y
1
+
x
2
y
0
+
x
0
y
1
−
x
0
y
0
=
x
1
y
2
− x
1
y
0
− x
0
y
2
− x
2
y
1
+
x
2
y
0
+
x
0
y
1
=(
x
0
y
1
− x
1
y
0
)+(
x
1
y
2
− x
2
y
1
)+(
x
2
y
0
− x
0
y
2
)
(6.38)
But the area of the triangle formed by the three vertices is
2
r
×
s
. Therefore
area =
1
2
[(
x
0
y
1
−
x
1
y
0
)+(
x
1
y
2
−
x
2
y
1
)+(
x
2
y
0
−
x
0
y
2
)]
(6.39)
which is the formula disclosed in Chapter 2!
6.5 Summary
Even if you already knew something about vectors, I hope this chapter has
introduced some new ideas and illustrated the role vectors play in computer
graphics.