Graphics Reference
In-Depth Information
C
R 5 (1 2 s ) Q 1 sC
Q
5
(1
2
t ) A
1
tB
A
B
Figure 7.14: The point Q =(
1
t ) A + tB is on the edge between A and B (provided
t
[
0, 1
]
), and
(
1
s
)
Q
+
sC is on the line segment from Q to C (when s
[
0, 1
]
).
v ) 2
r 2 )( d
( d
·
>
( v
·
v
·
d )
(7.111)
and one solution if the two sides are equal.
Note that if we choose to represent our ray with a vector d that has unit length,
this computation simplifies somewhat, since d
d = 1.
The examples above—line-line intersection, line-plane intersection, ray-
sphere intersection—all serve to illustrate the following general principle.
·
T HE PARAMETRIC / IMPLICIT DUALITY PRINCIPLE : There's a duality
between parametric and implicit forms for shapes. In general, it's easy to find
an intersection between shapes where one is described implicitly and the other
parametrically, and harder when either both are implicit or both are parametric.
s
7.9 Triangles
t
Triangles, which are familiar from geometry, are the building blocks of much of
computer graphics. If a triangle has vertices A , B , and C , then a point of the form
Q =( 1
B
t
1 is on the edge between A and B (see
Figure 7.14). Similarly, a point of the form R =( 1
t ) A + tB , where 0
t
s ) Q + sC is on the line
A
segment between Q and C if 0
s
1. Expanding this out, we get
R =( 1
s )( 1
t ) A +( 1
s ) tB + sC .
(7.112)
s
Equation 7.112 is worth examining carefully in several ways. First, we can
define a function,
C
Figure 7.15: The function F
:
R 2 :( s , t )
F :[ 0, 1 ]
×
[ 0, 1 ]
( 1
s )( 1
t ) A +( 1
s ) tB + sC ,
(7.113)
[ 0, 1 ] × [ 0, 1 ] R 2
:( s , t )
( 1 s )( 1 t ) A +( 1 s ) tB +
stC , from the unit square to the
triangle ABC, sends the entire
s = 1 edge to the point C. All
other lines in the square are sent
to lines in the triangle as shown.
whose image is exactly the triangle ABC (see Figure 7.15). F sends the entire
right edge ( s = 1) of the square to the single point C . Vertical lines ( s = constant )
are sent to lines parallel to AB . Horizontal lines ( t = constant ) are sent to lines
through C and a point of the edge AB .This parameterization of the triangle (the
variables s and t are the parameters) is often used in graphics.
 
 
 
Search WWH ::




Custom Search