ftxi / epicycles

A small program to display epicycles with given image using Fourier Transform.
https://sclereid.github.io/epicycles
GNU General Public License v3.0
22 stars 4 forks source link

ask for advice #7

Open zcdliuwei opened 3 years ago

zcdliuwei commented 3 years ago

Hello, I'm very interested in your work. What a wonderful display !! Personally, Fourier seems to imitate the process of human painting, and all the examples you show can be drawn with one stroke. I would like to ask if Fourier supports multiple strokes. Suppose there are two butterflies in the original PNG image, or there are multiple paths in my SVG file, I want to draw two butterflies with two strokes, because if one stroke is used, there will be a big jump between the two targets, And even if there is only one target or path, I also want to use multiple strokes in order to simplify and not cause a lot of jumping details, So in general, my question is how to control Fourier drawing so that it can support user-defined stroke number? I'm looking forward to your answer,Thank you very much。

ftxi commented 3 years ago

Thanks for your interest in my work.

I wrote these in the high school years and left it for a while. At this moment, I would like to view the problem in another perspective.

The essence of this illustration is the convergence of Fourier series. Given a periodic parameterized curve s_0 under certain conditions, say, continuous and piecewise Lipschitz continuous, the Fourier series s_n of this curve (viewed as an 1-parameter complex function defined on the closed interval [0,T]) converges to the original curve in the uniform sense, i.e. sup{|s_n(t) - s_0(t)|, t from 0 to T} -> 0 as n->infinity. Such convergence fits in my illustration, since when two curves are close in the function space (with metric defined as that supremum), the viewers feel that the two animations are similar.

However, uniform convergence fails when the curve is unfortunately, for example, discontinuous. Nevertheless, there is a more generalized version of this convergence theorem, that is the Fourier series of any L^2 function converges to that very function in the L^2 sense. My illustration, though, does not reflect this type of convergence well: a turbulence in (t, t+\epsilon) might affect the L^2 norm trivially, yet strikes the uniform norm quite violently, causing the image change in an uncanny way.

So, why not just change the presentation so that it will reflect the L^2 convergence? My current idea is, if we do not draw the curve like a pen that leaves a trail wherever it crosses, but do it resembling a dripping brush that emits ink in a constant rate through time, this difficulty might be overpassed.

Move back to your question. For outlines with more than one component, to draw the components separately and simultaneously is a viable solution. The mathematics underneath this is trivial; to engineer, perhaps a few copy & paste or wrapping in loops would suffice. However, my arguments above provides a different solution which I find more interesting.

As for having multiple strokes for one target, I believe this is more of an atheistic phenomenon, which is hard to think up a general solution without working on specific examples.

(This thread is still open; feel free to discuss if you have any questions or suggestions)

zcdliuwei commented 3 years ago

Hello, I'm so excited to see your timely and useful reply, let me have a clearer understanding of Fourier series. I'll study your code carefully in the next few days, I should like to ask you more about Fourier. I hope we can have more discussions,Thanks again. have a nice day!