I want to plot contours of the signed distance function of a region defined by an implicit equation: $R = \{ (x,y) : F(x,y) \le 0 \}$. As a trivially simple concrete example, we could take the region to be the elliptical shape where $F(x,y) = x^2 + 4y^2-1$.
I define Gxy = SignedRegionDistance[R], and then I pass Gxy to the ContourPlot function. It works, but it’s pretty slow -- around a minute on a decent laptop.
What can I do to speed it up? I hope the answer is not "buy a better laptop" :-)
Also, I get mysterious error messages that I don't understand:
Max::nord: Invalid comparison with 1.71429 -1.3924 I attempted. >>
Here is my code:
Fxy = x^2 + 4*y^2 - 1;
R = ImplicitRegion[Fxy <= 0, {x, y}];
Gxy = SignedRegionDistance[R, {x, y}];
levels = {-0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3};
ContourPlot[Gxy, {x, -2, 2}, {y, -1, 1}, Contours -> levels,
ContourShading -> None, AspectRatio -> Automatic]


