Graphics Reference
In-Depth Information
is the set of parameters for the points in S « X . In other words, if I is not empty, then
[
]
SX P PPP PP
«= +
a
,
+
b
.
1
1
2
1
1
2
We shall explain this process with the example in Figure 3.4. In this example,
I = [] « •
[
) «-•
(
] « •
[
) = [
]
01
,
t
,
,
t
t
,
t
,
t
,
1
2
3
3
2
which clearly gives the right answer.
3.2.3
Liang-Barsky Line Clipping
The Liang-Barsky line-clipping algorithm ([LiaB84]) optimizes the Cyrus-Beck line-
clipping algorithm in the case where we are clipping against a rectangle. It starts by
treating a segment as a parameterized set. Let P 1 = (x 1 ,y 1 ) and P 2 = (x 2 ,y 2 ). A typical
point P = (x,y) on the oriented line L determined by P 1 and P 2 then has the form
P 1 + t P 1 P 2 . See Figure 3.5. If we let Dx = x 2 - x 1 and Dy = y 2 - y 1 , then
xx
=+
=+
D
D
xt
1
yy
yt
.
1
If the window W we are clipping against is the rectangle [xmin,xmax] ¥ [ymin,ymax],
then P belongs to W if and only if
x
min
£+
x
D
D
x t
£
x
max
1
y
min
£+
y
y t
£
y
max
1
that is,
-£-
£ -
-£-
£
D
D
D
D
xt
x
min
max
x
1
xt
x
x
1
yt
y
y
min
1
yt
y
max
-
y
.
1
Figure 3.5.
Liang-Barsky line clipping.
Search WWH ::




Custom Search