Lumpy Torus and its Sublevel Sets

Below is an embedding of the graph of the function [math]f:\mathbb T ^2\rightarrow \mathbb R^3[/math], where [math]f(x,y)=\sin(4\pi x)\cos(6\pi y)[/math]. I was interested in the sublevel sets [math]f((-\infty,c))[/math], and this is my visualization. There's a little bit of fail in it--the image is accurate at [math]c\in\{-1,0,1\}[/math], but I didn't solve for the limits on the coordinates (so you see boxes where we might expect ellipsish boundaries). In any case, [math]a[/math] is a scalar on the height function [math]f[/math]--drop it to zero and you have a donut. That height is interpreted here in the direction of the outward pointing normal vector of a point on the surface. The [math]r[/math] slider controls the minor radius of the torus.

Information: Lumpy Torus and its Sublevel Sets