Graphics Reference
In-Depth Information
if we want to implement visible surface algorithms, then we need the z. Note that the
transformation is not a motion and will deform objects. However, and this is the
important fact, it preserves relative z-distances from the camera and to determine
the visible surfaces we only care about relative and not absolute distances. More pre-
cisely, let p 1 and p 2 be two points that lie along a ray in front of the camera and assume
that they map to p 1 ¢ and p 2 ¢, respectively, in clip space. If the z-coordinate of p 1 is
less than the z-coordinate of p 2 , then the z-coordinate of p 1 ¢ will be less than the z-
coordinate of p 2 ¢. In other words, the “in front of” relation is preserved. To see this,
let p i = (t i x, t i y, t i z), 0 < t 1 < t 2 , and p i ¢=(x i ¢, y i ¢, z i ¢). It follows from (4.10) that
d
tz
d
dd
Ê
Ë
ˆ
¯
¢
n
f
z
=-
1
i
(
)
-
i
f
n
from which it is easy to show that t 1 < t 2 if and only if z 1 ¢<z 2 ¢.
4.6
Clipping
In the last section we showed how to transform the clipping problem to a problem of
clipping against the unit cube in clip space. The actual clipping against the cube will
be done in homogeneous clip space using homogeneous coordinates (x,y,z,w). The
advantage of homogeneous coordinates was already alluded to: every point of camera
space is sent to a well-defined point here because values become undefined only when
we try to map down to clip space by dividing by w, which may be zero.
Chapter 3 discussed general clipping algorithms for individual segments or whole
polygons. These have their place, but they are not geared to geometric modeling envi-
ronments where one often wants to draw connected segments. We shall now describe
a very efficient clipping algorithm for such a setting that comes from [Blin91a]. It uses
the “best” parts of the Cohen-Sutherland, Cyrus-Beck, and Liang-Barsky algorithms.
In homogeneous coordinates halfplanes can be defined as a set of points that have
a nonnegative dot product with a fixed vector. For example, the halfplane ax + by +
cz + d ≥ 0, is defined by the vector (a,b,c,d) in homogeneous coordinates. Therefore,
by lining up vectors appropriately, any convex region bounded by planes can be
defined as the set of points that have nonnegative dot products with a fixed finite set
of vectors. In our case, we can use the following vectors for the six bounding planes
x = 0, x = 1, y = 0, y = 1, z = 0, and z = 1 for the unit cube I 3 :
= (
)
= (
)
= (
)
B
1000
,,, ,
B
0100
,,, ,
B
0010
,,, ,
1
3
5
= (
)
(
)
(
)
B
10 01
,,, ,
B
=-
0
, ,, ,
101
B
=
0 0
,, ,.
-
11
2
4
6
If p = (x,y,z,w), then let BC i = BC i ( p ) = p B i . We shall call the BC i the boundary coor-
dinates of p . These coordinates are easy to compute:
BC
=
x
,
BC
=
y
,
BC
=
z
,
1
3
5
BC
=-
w
x
,
BC
=-
w
y
,
BC
=-
w
z
.
2
4
6
Search WWH ::




Custom Search