i
i
i
i
i
i
i
i
2.5. Curves and Surfaces 33
where k
is any non-zero constant. By definition, “uphill” implies a positive
change in f, so we would like k
> 0,andk
=1is a perfectly good convention.
As an example of the gradient, consider the implicit circle x
2
+ y
2
− 1=
0 with gradient vector (2x, 2y), indicating that the outside of the circle is the
positive region for the function f (x, y)=x
2
+ y
2
− 1. Note that the length
of the gradient vector can be different depending on the multiplier in the implicit
equation. For example, the unit circle can be described by Ax
2
+Ay
2
−A =0for
any non-zero A. The gradient for this curve is (2Ax, 2Ay). This will be normal
(perpendicular) to the circle, but will have a length determined by A.ForA>0,
the normal will point outward from the circle, and for A<0, it will point inward.
This switch from outward to inward is as it should be, since the positive region
switches inside the circle. In terms of the height-field view, h = Ax
2
+ Ay
2
−A,
and the circle is at zero altitude. For A>0, the circle encloses a depression,
and for A<0, the circle encloses a bump. As A becomes more negative, the
Figure 2.27. The vector a
points in a direction where
f
has no change and is thus
perpendicular to the gradi-
ent vector ∇
f
.
bump increases in height, but the h =0circle doesn’t change. The direction
of maximum uphill doesn’t change, but the slope increases. The length of the
gradient reflects this change in degree of the slope. So intuitively, you can think
of the gradient’s direction as pointing uphill and its magnitude as measuring how
uphill the slope is.
Implicit 2D Lines
The familiar “slope-intercept” form of the line is
y = mx + b. (2.14)
This can be converted easily to implicit form (Figure 2.28):
y − mx − b =0. (2.15)
Here m is the “slope” (ratio of rise to run) and b is the y value where the line
crosses the y-axis, usually called the y-intercept . The line also partitions the 2D
plane, but here “inside” and “outside” might be more intuitively called “over” and
“under.”
Figure 2.28. A 2D line can
be described by the equa-
tion
y
−
mx
−
b
=0.
Because we can multiply an implicit equation by any constant without chang-
ing the points where it is zero, kf(x, y)=0is the same curve for any non-zero
k. This allows several implicit forms for the same line, for example,
2y − 2mx − 2b =0.
One reason the slope-intercept form is sometimes awkward is that it can’t rep-
resent some lines such as x =0because m would have to be infinite. For this