Graphics Reference
In-Depth Information
Figure 13.6.
Sederberg-Nishita Bézier clipping.
If d
1
d
2
£ 0, then let
4
9
4
9
{
}
{
}
d
=
min
0
,
d
,
d
and
d
=
max
0
,
d
,
d
.
min
12
max
12
After these preliminaries, we are ready to describe the Bézier clipping algorithm.
Let p(u) and q(u) be the two Bézier curves with domain [0,1] whose intersection we
want to determine. Let
X
be a fat line that contains the curve q(u). See Figure 13.6(a).
In that example,
X
is the region between the parallel lines
L
1
and
L
2
. We want to deter-
mine the values of u for which p(u) lies outside of
X
. Express p(u) in the form
n
Â
()
=
()
pu
B
u
p
,
(13.10)
in
,
i
i
=
0
where B
i,n
(u) are the Bernstein polynomials and
p
i
= (x
i
,y
i
) are the control points of
p(u). Let equation (13.8) be the equation of the line through
p
0
and
p
n
and let d(u)
be the signed distance from p(u) to
L
. It is easy to show that
n
Â
()
=
()
d u
B
u d
,
d
=++
ax
by
c
.
in
,
i
i
i
i
i
=
0
Finally, define the parametric curve
n
Â
()
=
()
Du
B
u
D
in
,
i
i
=
0
(
()
)
=
udu
,
,
where
D
i
= (t
i
,d
i
) and t
i
= i/n. The fact that the x-coordinate of D(u) is u follows from
the identities