Smoothing images

The image quality suffers if the mapping functions X(x,y) and Y(x,y) of the position (x,y) of a pixel of the output image to the position (X,Y) of the sampled input image pixel are strongly contracting or expanding.

For contracting mappings many pixels of the output image are mapped to the same single pixel of the input image. Without interpolation such a pixel appears magnified in the output image as a large patch of uniform color. You can see an example in “How to generate rosettes“. With cubic interpolation we can remove this defect , see the post “interpolation of pixels“.

For strongly expanding mappings neighboring output pixels are mapped to input pixels that lie far away from each other. If they are further apart than the size of characteristic details of the input image, then we get artifacts in the output image. An example are the nearly random pixels at the center of this spiral image:

This is essentially aliasing. We can improve the image by averaging, see “Smoothing and anti-aliasing“. Using four sampling points for each output pixel gives a much nicer image:

Obviously, interpolation and averaging slows down image generation and should only be used where needed. Often, we need neither of them. And never both. The generating program should analyze the mapping and choose the image improvement.

Posted in Kaleidoscopes, programming | Tagged , , | Leave a comment


Spiral designs are attractive and we can easily get them by transforming periodic designs. An example is the “Iris Spiral” created by Frank Farris. In my earlier post “Nautilus” I tried to explain the method and showed some results. Unfortunately, that post is too confusing. Everything becomes easier using complex functions.

The position (x,y) of a pixel of the output image is the same as a complex number z=x+iy. The mapping to pixels of the input image takes several steps. First we use polar coordinates z=r exp(iφ) and the complex logarithm ln(z)=ln(r)+iφ. This maps the plane to an infinite horizontal strip of width 2π. We get a smooth output image if the image in this plane is periodic in y-direction with a period length of 2π. This corresponds to a translation vector (0,2π). We then can use a translation and scaling as a second mapping to a periodic transformation of the input image. This second mapping matches the translation vector to multiples of the periods of this image.

In the most simple case we get the periodic image from the input image with a mapping using packages of waves with square symmetry. If the components of the wave vectors are integers, then the basic periods are 2π in x- and y-direction and we have to transform the translation vector (0,2π) to a vector of the form 2π(m,n), where m and n are integers. If n is much larger than m then we see m different spiral arms. Each arm repeats n times a distorted primitive cell of the periodic image for one turn around the center. Other spirals will appear depending on the structure of the input image.

If h is the greatest common divisor of n and m then we get an h-fold rotational symmetry around the center of the spiral. As an example suppose that n is a multiple of m. Then we get an n-fold rotational symmetry.

We can similarly use periodic intermediate images of 3- and 6-fold rotational symmetry. Instead of a Cartesian lattice of integer choices (n,m) we then have a lattice of Eisenstein integers.

Here is a result for n=7 and m=2 with an intermediate periodic image of square symmetry. There is no particular rotational symmetry around the center because 2 and 7 are relatively prime. Strong diagonal accents of the periodic image give rise to additional spirals:





Posted in Anamorphosis, Kaleidoscopes | Tagged , , , | Leave a comment

Better images from higher harmonics ?

Maybe you have noticed that a lot of round shapes without details in the recent images of this blog. They resemble bulls-eyes. Here is an example:

It’s a periodic image with square symmetry and no mirror symmetry. Its big grey discs are somewhat annoying. They arise because I used a simple cosine wave for each wave vector in its image mapping functions X(x,y) and Y(x,y). The cosine function cos(x) has a rather broad maximum at x=0. Thus X and Y do not vary much around x=y=0 where the grey discs lie.

To improve the image we want waves that vary more rapidly at the maximum and minimum, something more like a triangle wave with its sharp maxima and minima. Using the Fourier series of the triangle function we can add higher harmonics to the basic cos(x) function. Adding cos(3x)/9 we get already more details:

The circular shapes become more like squares. The deviation from mirror symmetry becomes more obvious.

Going further and replacing cos(x) by cos(x)+cos(3x)/9+cos(5x)/25 we have more structure:

Further convergence is slow. We should not exaggerate, because replacing the cosine by the triangle function gives a patched image:

Seems between patches appear as discontinuities in the directions of the black and white lines.

To speed up image creation you should use linear interpolation of tables for the sine and cosine functions as discussed in “fast approximations …“. You can improve on this using tables for the above combinations of trigonometric functions.


Posted in Anamorphosis, Kaleidoscopes, programming | Tagged , , | Leave a comment

2-color mirror symmetry

We now want an image with periodic or quasi-periodic rotational symmetry that changes colors upon mirroring. Thus we need a color-changing function U(x,y) that changes the sign


for its mirror image at the x-axis. We can easily get this from the difference between packages of wave functions f(x,y) and their mirror images


For more details you can look at the last post. This is a result with 8-fold rotational symmetry and 2-color mirror symmetry:

The center of perfect symmetry lies outside this image. You can see local approximate 2-color mirror symmetry in many places as well as approximate 8-fold and 4-fold rotational symmetry.


Posted in Anamorphosis, Kaleidoscopes, Quasiperiodic design | Tagged , , , , | Leave a comment

Mirror symmetry and rotational symmetry

To study mirror symmetry at the x-axis together with rotational symmetry we can do similarly as in the earlier post “improved symmetric sum“. Here I prefer to present only the conclusions, which you could get by intuition too.

It is important to know how the packages of wave functions with rotational symmetry change when the drawing plane is mirrored. What is

for r-fold rotational symmetry and where M stands for a mirror symmetry?

Note that we want a mirror symmetry at the x-axis with M(x,y)=(x,-y). Then the rotational symmetry gives us more mirror symmetries at axis with angles of integer multiples of π/r. Actually, the unit vectors e are mirror axis and the lines exactly between two adjacent unit vectors are mirror axis too. M can be any of these mirror symmetries. Then

where the mirror image of the wave vector simply reverses its components. In general:

where we can do additional, essentially irrelevant rotations. If the wave vector has only one non-zero component then the package of wave functions is mirror symmetric, M(k,0,0,…)≅(k,0,0,…). If there are two non-zero components, then they get exchanged, M(k,g,0,0,…)=(g,k,0,0,…) and we can get a wave package that is not mirror symmetric with respect to the x-axis.

We can always make that a rotationally symmetric package of waves becomes mirror symmetric by adding its mirror image

but most of the time I get a mirror symmetric image by accident.

Actually, it is quite difficult to get quasi-periodic images that are not mirror symmetric. Here is an example of 5-fold rotational symmetry. The center of perfect symmetry lies near its bottom left corner.

Look out for local approximate mirror symmetries !




Posted in Anamorphosis, Kaleidoscopes, Quasiperiodic design | Tagged , , , | Leave a comment

Improved two-color symmetry upon rotation

As discussed in the post “two-color rotational symmetry” we get only a single real color-changing function U(x,y) instead of a mapping W(x,y)=U(x,y)+iV(x,y) to the complex plane. Thus we need a special approach to get a mapping to the input image which is continuous when the color changes and relates to the color-changing function U.

For r-fold rotational symmetry the elementary rotation R(2π/r) simply changes the sign of U and we can use the absolute value of U(x,y) as the x-component for the mapping to the input image X(x,y)=|U(x,y)|. This is an extra imposed mirror symmetry and relates the color change to the anamorphic distortion of the input image. For the y-component we can use any function Y(x,y) that does not change upon the elementary rotation. This is a typical result:

There is another, more sophisticated way. We can use another two-color-changing function V(x,y) to get a full mapping to the W=U+iV plane. An elementary rotation changes the sign of W(x,y) which implies a two-fold rotational symmetry. Thus, similar to the other color symmetries we can use as a mapping to the input image Z(x,y)=f(|W|)*[W(x,y)]². The color is still determined by the sign of U(x,y) and a typical result looks like this:

Posted in Anamorphosis, Kaleidoscopes, Quasiperiodic design | Tagged , , , , | Leave a comment

improved combination of color symmetry and rotation

As mentioned in the last post using two unrelated anamorphic mappings, one for reading the input image and another one for choosing color variants, makes it difficult to create interesting images. From the mapping that determines the color variant we get a related mapping to the input image. This simplifies image creation and gives better results.

For n-fold color symmetry and r-fold rotational symmetry the complex valued mapping W(x,y) changes upon a rotation by an angle of 2π/r  as:

The mapping Z(x,y)=X(x,y)+iY(x,y) to the input image should not change upon this rotation and it should depend on W. This has a simple solution:

where the n-th power of W eliminates the phase factor that appears at rotations of W. We can use the scalar function f to reduce the power of the zero at W=0. This method effectively maps the output image to an anamorphic rosette image of the input and comes close what Farris has presented in “Creating symmetry”.

Here are some results I got using this method for three-color symmetry. A periodic image with six-fold rotational symmetry:

and a quasi-periodic image with 9-fold rotational symmetry and some accidental approximate symmetry:

Posted in Anamorphosis, Kaleidoscopes, Quasiperiodic design, Tilings | Tagged , , , , | Leave a comment