Game Development Reference
In-Depth Information
we want. Before we do that, this section considers the opposite problem:
how to take a curve and chop it up into smaller pieces.
Why would we ever want to do this? There are a couple of reasons.
Curve refinement. In the process of designing a curve interactively,
we may find that we almost have the shape we want, but one curve
can't quite give us the flexibility that we need. So we cut the curve
into two pieces (forming a spline), which gives us greater flexibility.
Approximation techniques. Another reason to subdivide a curve is
that a piece of a curve is generally simpler than the whole curve,
where “simpler” means “more like a straight line.” So we can cut
it into a su ciently large number of pieces, and then do something
with those pieces as if they were straight line segments, such as render
them or raytrace them. In this way, we can approximate the result we
would get if we were able to render or raytrace the curve analytically.
Strictly speaking, we don't need subdivision to do piecewise linear
approximation—we already discussed one simple technique that eval-
uates the curve at fixed-size intervals and draws lines between those
sample points. But subdivision allows us to choose the number of line
segments adaptively by using fewer line segments on the straighter
parts of the curve and more line segments on the curvier parts.
So that's the “why” of curve subdivision. Before we learn the “how,”
let's be a bit more precise about the “what.” Consider a parametric polyno-
mial curve P defined by the function p (t), adopting the usual conventions
that the curve starts at t = 0 and ends at t = 1. Now consider a segment Q
that starts at an arbitrary time t = a and ends at t = b. This is illustrated
in Figure 13.15.
Figure 13.15. Extracting a segment of a curve by using subdivision
The goal of subdivision is a mathematical description for Q in some form
(monomial, Hermite, or Bezier). But don't we already have that? After
all, we assume that have a mathematical description of P in some form,
and so it's perfectly valid to define Q by saying, “Take the curve defined
Search WWH ::




Custom Search