Can a closed curve be represented by a level set which is zero on the boundary, negative on the interior and positive otherwise?

54 Views Asked by At

Suppose we have a parameterisation of a simple closed curve $\mathcal{C}$. Does there exist a function $f:\mathbb{R}^2\to\mathbb{R}$ such that $\mathcal{C}=\{x,y : f(x,y)=0\}$ and the interior and exterior of $\mathcal{C}$ are given by $\mathrm{in}(\mathcal{C})=\{x,y:f(x,y) < 0\}$ and $\mathrm{ex}(\mathcal{C})=\{x,y:f(x,y) > 0\}$ respectively?

Clearly if $\cal{C}$ is the unit circle, then such a function is given by $f(x,y)=x^2 + y^2 - 1$.

Does such a function exist more generally? If so: proof? If not: why? Given a parameterisation $\gamma$ of $\mathcal{C}$, how could I construct $f$? I am happy to assume that $\gamma$ is analytic and has no cusps if necessary. Perhaps a homeo/diffeomorphism between $\cal{C}$ and the unit circle will help here.

Part of my motivation for asking is that I am currently working on software where I have to test if points are inside or outside (or on the boundary) of a closed region. This requires me to consider a line segment from my point of interest to infinity (or more practically a point known to be outside) and count the number of intersection points. Not only is this complex and slow, it also requires root finding to numerical precision in order to identify points very close to the boundary. However, if I am working with a circle then it is very easy. I simply test the sign of $x^2+y^2-1$ (or some translation/dilation of it).

Edit:

After the (good) answer by Steven, I should add: Given a parameterisation $\gamma$ of $\mathcal{C}$, how could I construct $f$ without explicit knowledge of which points exist in the interior and which points exist in the exterior. I say this as both his answers (continuous and not) for an arbitrary function require this information apriori and thus are not useful in testing whether or not a point is in the interior.

1

There are 1 best solutions below

5
On BEST ANSWER

I'm going to assume that there's a typo and that you want your $f$ to be a function from $\mathbb{R}^2\mapsto\mathbb{R}$, not from the plane to itself. Also, presumably you want $f()$ to be continuous; otherwise the solution is trivial — take $f(\mathbf{x})=-1$ for $\mathbf{x}$ inside the curve, $f(\mathbf{x})=0$ for $\mathbf{x}$ on the curve, and $f(\mathbf{x})=1$ for $\mathbf{x}$ outside the curve. But even with continuity, it's pretty straightforward: let $g(\mathbf{x})$ be the unsigned minimum (you might need an infimum here but I don't think you should) distance from $\mathbb{x}$ to $\gamma$, and multiply $g()$ by the appropriate $\pm1$ inside/outside factor.

But better still, if your curve $\gamma$ is rational — that is to say, it can be expressed in the form $\gamma(t) = \langle \dfrac{p(t)}{r(t)},\dfrac{q(t)}{r(t)}\rangle$ for polynomial functions $p,q,r$ — then you can find a polynomial $f$ whose level set is the given curve. This process is known as implicitization of the parametric equation and you should be able to find details about it by passing those magic words into your favorite search engine; for instance this summary of the process for the case where the denominator $r()$ is just the unit function $r(t)=1$ and so the curve is $\gamma(t)=\langle p(t),q(t)\rangle$.

Note that in this latter case, it's also not too hard to determine inside vs. outside; just look at the leading x and y terms of your polynomial. Assuming that you have a 'clean' level set (that is, no infinite components to it) then these will both be even powers and they'll be either both positive or both negative. (Otherwise, there would be lines along which you can go to either $+\infty$ or $-\infty$ and therefore a curve between those lines where the zeroset itself goes to infinity.) If they're both positive, then the 'outside' component has to be the one in which $f(\mathbf{x})\gt 0$ and so the inside component is the one where $f(\mathbf{x})\lt 0$; likewise if they're both negative then the inside component is the one where $f(\mathbf{x})\gt 0$.