i
i
i
i
i
i
i
i
13.1. Parametric Cur ves 585
Figure 13.8. An e is represented by a number of straight lines and quadratic B´ezier
curves (left). In the middle, this representation has been “tessellated” into a number of
bounded ezier curves (red and blue), and triangles (green). The final letter is shown
to the right. (Reprinted with permission from Microsoft Corporation.)
for each pixel, where u and v are interpolated texture coordinates:
f(u, v)=u
2
v. (13.13)
The pixel shader then determines whether the pixel is inside (f(u, v) < 0),
or otherwise outside. This is illustrated in Figure 13.7. When rendering a
perspective-projected triangle with this pixel shader, we will get the cor-
responding projected ezier curve. A proof of this is given by Loop and
Blinn [788, 791].
This type of technique can be used to render TrueType fonts, for ex-
ample. This is illustrated in Figure 13.8. Loop and Blinn also show how
to render rational quadratic curves and cubic curves, and how do to anti-
aliasing using this representation.
13.1.3 Continuity and Piecewise B
´
ezier Curves
Assume that we have two B´ezier curves that are cubic, that is, defined by
four control points each. The first curve is defined by q
i
, and the second
by r
i
, i =0, 1, 2, 3. To join the curves, we could set q
3
= r
0
.Thispoint
is called a joint. However, as shown in Figure 13.9, the joint will not
be smooth using this simple technique. The composite curve formed from
several curve pieces (in this case two) is called a piecewise B´ezier curve,and
is denoted p(t) here. Further, assume we want p(0) = q
0
, p(1) = q
3
= r
0
,
and p(3) = r
3
. Thus,thetimesforwhenwereachq
0
, q
3
= r
0
,andr
3
,
are t
0
=0.0, t
1
=1.0, and t
2
=3.0. See Figure 13.9 for notation. From
the previous section we know that a ezier curve is defined for t [0, 1],
so this works out fine for the first curve segment defined by the q
i
’s, since
thetimeatq
0
is 0.0, and the time at q
3
is 1.0. Butwhathappenswhen
1.0 <t 3.0? The answer is simple: We must use the second curve
segment, and then translate and scale the parameter interval from [t
1
,t
2
]
i
i
i
i
i
i
i
i
586 13. Curves and Curved Surfaces
Figure 13.9. This figure shows from left to right C
0
, G
1
,andC
1
continuity between two
cubic ezier curves (four control points each). The top row shows the control points,
and the bottom row the curves, with 10 sample points for the left curve, and 20 for the
right. The following time-point pairs are used for this example: (0.0, q
0
), (1.0, q
3
), and
(3.0, r
3
). With C
0
continuity, there is a sudden jerk at the join (where q
3
= r
0
). This
is improved with G
1
by making the tangents at the join parallel (and equal in length).
Though, since 3.0 1.0 =1.0 0.0, this does not give C
1
continuity. This can be seen
at the join where there is a sudden acceleration of the sample points. To achieve C
1
,
the right tangent at the join has to be twice as long as the left tangent.
to [0, 1]. This is done using the formula below:
t
=
t t
1
t
2
t
1
. (13.14)
Hence, it is the t
that is fed into the B´ezier curve segment defined by the
r
i
’s. This is simple to generalize to stitching several B´ezier curves together.
A better way to join the curves is to use the fact that at the first control
point of a B´ezier curve the tangent is parallel to q
1
q
0
(see Section 13.1.1).
Similarly, at the last control point the cubic curve is tangent to q
3
q
2
.
This behavior can be seen in Figure 13.4. So, to make the two curves join
tangentially at the joint, the tangent for the first and the second curve
should be parallel there. Put more formally, the following should hold:
(r
1
r
0
)=c(q
3
q
2
)forc>0.
(13.15)
This simply means that the incoming tangent, q
3
q
2
, at the joint should
have the same direction as the outgoing tangent, r
1
r
0
.
i
i
i
i
i
i
i
i
13.1. Parametric Cur ves 587
It is possible to achieve even better continuity than that, using in Equa-
tion 13.15 the c defined by Equation 13.16 [332]:
c =
t
2
t
1
t
1
t
0
. (13.16)
This is also shown in Figure 13.9. If we instead set t
2
=2.0, then
c =1.0, so when the time intervals on each curve segment are equal, then
the incoming and outgoing tangent vectors should be identical. However,
this does not work when t
2
=3.0. The curves will look identical, but the
speed at which p(t) moves on the composite curve will not be smooth. The
constant c in Equation 13.16 takes care of this.
Some advantages of using piecewise curves are that lower degree curves
can be used, and that the resulting curves will go through a set of points.
In the example above, a degree of three, i.e., a cubic, was used for each
of the two curve segments. Cubic curves are often used for this, as those
are the lowest-degree curves that can describe an S-shaped curve, called
an inflection. The resulting curve p(t) interpolates, i.e., goes through, the
points q
0
, q
3
= r
0
,andr
3
.
At this point, two important continuity measures have been introduced
by example. A slightly more mathematical presentation of the continuity
concept for curves follows. For curves in general, we use the C
n
notation
to differentiate between different kinds of continuity at the joints. This
means that all the n:th first derivatives should be continuous and nonzero
all over the curve. Continuity of C
0
means that the segment should join
at the same point, so linear interpolation fulfills this condition. This was
the case for the first example in this section. Continuity of C
1
means that
if we derive once at any point on the curve (including joints), the result
should also be continuous. This was the case for the third example in this
section, where Equation 13.16 was used.
There is also a measure that is denoted G
n
. Let us look at G
1
(ge-
ometrical) continuity as an example. For this, the tangent vectors from
the curve segments that meet at a joint should be parallel and have the
same direction, but nothing about the lengths is assumed. In other words,
G
1
is a weaker continuity than C
1
, and a curve that is C
1
is always G
1
except when the velocities of two curves go to zero at the point where the
curves join and they have different tangents just before the join [349]. The
concept of geometrical continuity can be extended to higher dimensions.
The middle illustration in Figure 13.9 shows G
1
-continuity.
13.1.4 Cubic Hermite Interpolation
ezier curves are very useful in describing the theory behind the construc-
tion of smooth curves, but their use is not always intuitive. In this section,
i
i
i
i
i
i
i
i
588 13. Curves and Curved Surfaces
Figure 13.10. Blending functions for Hermite cubic interpolation. Note the asymmetry
of the blending functions for the tangents. Negating the blending function t
3
t
2
and
m
1
in Equation 13.17 would give a symmetrical look.
Figure 13.11. Hermite interpolation. A curve is defined by two points, p
0
and p
1
,and
a tangent, m
0
and m
1
, at each point.
i
i
i
i
i
i
i
i
13.1. Parametric Cur ves 589
we will present cubic Hermite interpolation, and these curves tend to be
simpler to control. The reason is that instead of giving four control points
to describe a cubic B´ezier curve, the cubic Hermite curve is defined by
starting and ending points, p
0
and p
1
, and starting and ending tangents,
m
0
and m
1
. The Hermite interpolant, p(t), where t [0, 1], is
p(t)=(2t
3
3t
2
+1)p
0
+(t
3
2t
2
+t)m
0
+(t
3
t
2
)m
1
+(2t
3
+3t
2
)p
1
. (13.17)
We also call p(t) a Hermite curve segment or a cubic spline segment.
This is a cubic interpolant, since t
3
is the highest exponent in the blending
functions in the above formula. The following holds for this curve:
p(0) = p
0
, p(1) = p
1
,
p
∂t
(0) = m
0
,
p
∂t
(1) = m
1
. (13.18)
This means that the Hermite curve interpolates p
0
and p
1
,andthe
tangents at these points are m
0
and m
1
. The blending functions in Equa-
tion 13.17 are shown in Figure 13.10, and they can be derived from Equa-
tions 13.4 and 13.18. Some examples of cubic Hermite interpolation can
be seen in Figure 13.11. All these examples interpolate the same points,
but have different tangents. Note also that different lengths of the tan-
gents give different results; longer tangents have a greater impact on the
overall shape.
Note that cubic hermite interpolation was used to render the hair in the
Nalu demo [929] (see Figure 13.1), where a coarse control hair was used
for animation and collision detection. Then tangents were computed, and
cubic curves tessellated and rendered.
13.1.5 Kochanek-Bartels Curves
When interpolating between more than two points using Hermite curves,
a way is needed to control the shared tangents. Here, we will present one
way to compute such tangents, called Kochanek-Bartels curves. Assume
that we have n points, p
0
,...,p
n1
, which should be interpolated with
n 1 Hermite curve segments. We assume that there is only one tangent
at each point, and we start to look at the “inner” tangents, m
1
,...,m
n2
.
A tangent at p
i
can be computed as a combination of the two chords [680]:
p
i
p
i1
,andp
i+1
p
i
, as shown at the left in Figure 13.12.
First, a tension parameter, a, is introduced that modifies the length of
the tangent vector. This controls how sharp the curve is going to be at the
joint. The tangent is computed as
m
i
=
1 a
2
((p
i
p
i1
)+(p
i+1
p
i
)). (13.19)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset