Quiz: curves as level sets

Short questions to test your understanding. Try each on paper first, then open the answer. Convention: the curve is where \phi = 0, with \phi < 0 inside.


Q1. \phi(x, y) = \sqrt{x^2 + y^2} - 2. Is the point (1, 1) inside or outside the curve? How far is it from the curve?

Evaluate \phi and look at the sign. This \phi is a signed distance.

\phi(1, 1) = \sqrt 2 - 2 = -0.59: inside, 0.59 from the circle (because this \phi is the signed distance, |\phi| is the distance).


Q2. You have \phi_A for a disk and \phi_B for a square. Which function describes “the disk with the square cut out of it”?

Cutting out = inside A and inside the complement of B.

\max(\phi_A, -\phi_B): -\phi_B is negative outside the square (the complement), and \max is the intersection.


Q3. Two disks of radius 1 at (\pm 1.2, 0) are combined with \min. For which levels c is the contour \phi = c one curve, and for which two?

Find \phi at the point between the disks.

At the origin \phi = 1.2 - 1 = 0.2, the lowest point of the gap between the two “valleys”. For -1 < c < 0.2 the contour is two circles of radius 1 + c; for c > 0.2 the circles overlap and the contour is one curve. The function is the same; only the cut changes.


Q4. Why is \nabla\phi perpendicular to the curve \phi = 0?

How does \phi change when you walk along the curve?

Along the curve \phi stays 0, so its rate of change in the tangent direction is zero: \nabla\phi \cdot \mathbf t = 0. The gradient therefore has no tangential component; it points across the curve, towards larger \phi (outward).


Q5. What is the curvature of a circle of radius 4? Of a straight line? Which sign does a dent (a concave part of the inside) have?

\kappa = 1/r for a circle with the inside convex.

1/4 = 0.25; a line has \kappa = 0. In a dent the normals converge instead of spreading out: \kappa < 0.


Q6. \phi_1 = \sqrt{x^2 + y^2} - 1 and \phi_2 = 5\phi_1. Do they describe the same curve? Which one is a signed distance function, and what is |\nabla\phi_2|?

Scaling does not move the zero set.

Same curve (the unit circle), same normals, same curvature. Only \phi_1 is a signed distance (|\nabla\phi_1| = 1); |\nabla\phi_2| = 5, so |\phi_2| overstates the distance five times.


Q7. A signed distance function is the distance transform with a sign. Where on the grid can |\nabla\phi| = 1 fail?

Think of the middle of a rectangle: which boundary point is nearest?

Where two (or more) boundary points are equally near: the “ridge” or medial axis inside a shape (the diagonals of a square, the centre of a disk). There the distance has a kink, the gradient jumps and finite differences give a smaller |\nabla\phi| and a very large curvature.


Q8. (math) For a signed distance function, show that \kappa = \nabla^2\phi.

Start from \kappa = \nabla\cdot(\nabla\phi/|\nabla\phi|).

With |\nabla\phi| = 1 the normal is \nabla\phi itself, so \kappa = \nabla\cdot\nabla\phi = \phi_{xx} + \phi_{yy} = \nabla^2\phi. (Check on the circle: \phi = \rho - r has \nabla^2\phi = 1/\rho.)