# Does this Algorithm (probably Fourier like) Exist for 2D Shapes? [closed]

Update: Someone changed the title to this post to a possible answer ("Fourier decomposition of parametric shapes") but I changed it to a different title as that makes it clear what I was asking. As I think putting the answer in the title makes it confusing to a new reader.

I am learning about programming so this question may be obvious.

We know that a Fourier series can approximate any sort of waveform for example, a square tooth waveform has to be decomposed into curved waveforms using Fourier series that have infinite analytic terms.

My question is is there an analogue (2D version) algorithm to the known Fourier decomposition algorithm for implicit 2 variable equations? An example of what I mean is as follows. Consider $$aX^2+bY^2=c$$ is the equation of an ellipse. Is there an algorithm that can express an (infinite?) number the ellipses terms (and maybe terms representing other shapes) in a way to get a rectangle. Say, a rectangle 50 units wide and 100 units high centered at $$(0,0)$$. The output of the algorithm would be an analytic function differentiable everywhere (like a Fourier series). The analogue of the periodicity I would guess is the angle if the equations were converted to parametric form. So this algorithm (or concept) if it exists I would say is Fourier like.

I would imagine if such an algorithm exists then probably using a few terms to approximate the rectangle using ellipses would result in a rectangle with some curvature in its side and the corners of the rectangle wouldn't look sharp, and using enough terms to approximate the rectangle using ellipses would result in a rectangle (if the equation was plotted on the screen by a computer program) and the corners would look sharper and sides more straight. I'm aware there are ways to plot a rectangle but I want to know if this algorithm exists.

In other words, my question is, is there an algorithm that takes as input equations representing 2D shapes (using some representation) and outputs an analytical expression of a desired shape that may not be analytical everywhere (such as rectangle- and it must be able to do a rectangle shape) and I would suspect this algorithm has similarities to the existing Fourier algorithms.

• There is of course a two- (or more) dimensional version of the Fourier transform, but there's no direct equivalent of a Fourier transform for shapes. (Shapes don't even form a vector space -- what would be the sum of two circles?) The best you can do is to use the implicit function theorem, and then apply the Fourier transform to the resulting parametrization. Going further afield, there's something called curvelets, which are a 2d generalization of wavelets, which are themselves generalizations of the basis used for Fourier series. – Christian Clason Feb 1 '16 at 0:17
• I am not sure I understood the question, but I would suggest looking at Fourier transform for functions $r(\varphi)$ given in polar coordinates. Then the basis functions would be not ellipses, but shapes with multiple petals. And it seems easy to convince oneself that rectangular shapes given in polar coordinates could be approximated by a series in this basis. – Dmitri Chubarov Feb 1 '16 at 4:38
• While I can understand not wanting to change the title in a manner that short-circuits the Question being asked, it seems to me that the change was a reasonable one, given your own discussion of "an analogue... to the Fourier decomposition" in the body of the Question. In any case a title that more specifically alerts Readers to the topic of discussion than "Does this Algorithm Exist?" would be an improvement. – hardmath Feb 4 '16 at 0:22
• There is an area of numerical research connected with moving boundaries called "shape functions". An earlier Question here may be enough of an introduction to decide if the material is of possible interest: Basic explanation of shape function. – hardmath Feb 4 '16 at 0:26
• @hardmath That question is about a different type of shape function, which has no relation to what this question is about; a better term to search for would be level set or phase field functions. – Christian Clason Feb 4 '16 at 10:44

You can write a curve as a parametric equation ($$x(t)$$, $$y(t)$$) for a range say $$0 < t < 1$$. Then you can have a Fourier decomposition of both $$x(t)$$ and $$y(t)$$. A rectangle can be written as such a parametric equation.