Graphics Reference
In-Depth Information
random number
t
in the domain of
f
, then with probability 1,
f
(
t
)=
0. (In general,
when we talk about
L
2
, we say that two functions are equal if they're equal almost
everywhere.)
These inner-pr
oduct
definitions in turn let us define a notion of “length,” by
defining
=
L
2
, and similarly for
2
. See Exercise 18.1 for
f
f
,
f
,for
f
∈
2
further details.
1
0
The term
sampling
is much used in graphics, with multiple meanings. Sometimes
it refers to choosing multiple random points
P
i
(
i
=
1, 2,
,
n
) in the domain
of a function
f
so that we can estimate the average value of
f
on that domain as
the average of the values
f
(
P
i
)
(see Chapter 30). Sometimes (as in the previous
edition of this topic) it's used to mean “generating pixel values by some kind of
unweighted or weighted averaging of a function on a domain,” the discrete nature
of the pixel array being the motivation for the word “sampling.” In this chapter,
we'll use it in one very specific way. If
f
is a
continuous
function on the real
line, then
sampling f
means “restricting the domain of
f
to the integers,” or, more
generally, to any infinite set of equally spaced points (e.g., the even integers, or all
points of the form 0.3
+
n
...
−
1
−
2
0
2
4
6
Figure 18.22: A “biased” square
wave; at integer points the values
are
−
1
.
/
2, for
n
∈
Z
).
2
For discontinuous functions, the definition is slightly subtler; for those who'd
rather ignore the details, it's sufficient to say that if
f
is piecewise continuous, but
has a jump discontinuity at the point
x
, then the sample of
f
at
x
is the average of
the left and right limits of
f
at
x
. Thus, for a square wave (see Figures 18.22 and
18.23) that alternates between
1
0
−
1 and 1, the sample at any discontinuity is 0.
The more general notion of sampling is motivated by the physical act of
mea-
surement.
If we think of the variable in the function
t
f
(
t
)
as time, then to
measure f
we must average its values over some nonzero period of time. If
f
is
rapidly varying, then the shorter the period, the better the measurement. To define
the sample of
f
at a particular time
t
0
, we therefore mimic this measurement pro-
cess. First, we consider points
t
0
−
→
−
1
−
2
0
2
4
6
a
and
t
0
+
a
, and define a function
χ
t
0
,
a
:
R
→
R
Figure 18.23: The samples of the
biased
where
χ
t
0
,
a
=
1if
t
0
−
a
≤
t
≤
t
0
+
a
and 0 otherwise (see Figure 18.24). The
square
wave
at
integer
function
χ
t
0
,
a
serves the role of the shutter in a camera: When we multiply
f
by
χ
t
0
,
a
, the values of
f
are “let through” only on the interval
[
t
0
−
points are all
0
.
a
,
t
0
+
a
]
.Next,
we let
U
(
a
)=
1
2
a
f
(
t
)
χ
t
0
,
a
(
t
)
dt
.
(18.26)
R
y
5x
t
0
, 0.25
(
t
)
U
(
a
)
is the “measurement” of
f
in the interval
[
t
0
−
a
,
t
0
+
a
]
, in the sense that it's
the average value of
f
on that interval. Problem 18.2 relates this to convolution.
Finally, we define the
sample of
f
at
t
0
to be
y
5x
t
0
, 0.5
(
t
)
y
1
5x
t
0
, 1
(
t
)
a
→
0
U
(
a
)
,
lim
(18.27)
0
that is, the limiting result of measuring
f
over shorter and shorter intervals. For a
continuous function
f
,if
a
is small enough, then
f
(
s
)
will be very close to
f
(
t
0
)
for
any
s
t
0
a
,
t
0
+
a
]
, and the limit of
U
(
a
)
is just
f
(
t
0
)
—the sample, defined by
this measurement process, is exactly the
value
of
f
at
t
0
as we said above; the full
proof depends on the mean value theorem for integrals. But for a discontinuous
∈
[
t
0
−
Figure 18.24: The function
χ
t
0
,
a
is nonzero only on the interval
[
t
0
−
a
,
t
0
+
a
]
.