Graphics Reference
In-Depth Information
??
(a)
(b)
(c)
(d)
Figure 9.10: (a) If we take convex combinations of points on a circle in
R
2
, the result is a
point in
R
2
, but it is not generally on the circle; (b) if we radially project back to the circle,
it works better . . . but the value is undefined when the original convex combination falls
at the origin. (c) If we do angular interpolation, the point halfway between
355
◦
and
5
◦
turns out to be
180
◦
. (d) If we try angular interpolation along the shortest route, our blend
becomes undefined when the points are opposites.
c
i
f
i
+
c
j
f
j
+
c
k
f
k
, where
c
1
+
c
2
+
c
3
=
1 and
c
1
,
c
2
,
c
3
≥
0,
(9.14)
make sense. For example, if you have a 2
2 symmetric matrix associated to each
vertex, you can perform barycentric blending of the matrices, because a convex
combination of symmetric matrices is still a symmetric matrix.
Unfortunately, there are many interesting spaces in which convex combina-
tions either don't make sense or fail to be defined for certain cases. The exemplar
is the circle
S
1
. If you treat the circle as a subset of
R
2
, then (see Figure 9.10)
forming convex combinations of two points makes sense . . . but the result is a
point in the unit disk
D
2
×
R
2
, and generally
not
a point on
S
1
.
The usual attempt at solving this is to “re-project” back to the circle, replacing
the convex combination point
C
with
C
⊂
. Unfortunately, this fails when
C
turns out to be the origin. The problem is not one that can be solved by any clever
programming trick.
It's a fairly deep theorem of topology that if
h
:
D
2
/
C
S
1
→
(9.15)
has the property that
h
(
p
)=
p
for all points of
S
1
, then
hmust
be discontinuous
somewhere.
Another possible approach is to treat the values as angles, and just interpolate
them. Doing this directly leads to some oddities, though: Blending some points
in
S
1
that are very close (like 350
◦
and 10
◦
) yields a point (180
◦
in this case)
that's far from both. Doing so by “interpolating along the shorter arc” addresses
that
problem, but it introduces a new one: There are two shortest arcs between
opposite points on the circle, so the answer is not well defined.
Once again, a theorem from topology explains the problem. If we simply con-
sider the problem of finding a
halfway
point between two others, then we're seek-
ing a function
H
:
S
1
S
1
S
1
×
→
(9.16)
with certain properties. For instance, we want
H
to be continuous, and we want
H
(
p
,
p
)=
p
for every point
p
S
1
, and we want
H
(
p
,
q
)=
H
(
q
,
p
)
, because “the
halfway point between
p
and
q
” should be the same as “the halfway point between
q
and
p
.” It turns out that even these two simple conditions are too much: No such
function exists.
∈