In the last post I used mirror symmetry at two crossing straight lines and the related inversion at a circle. The mirror symmetries generate a k-rotational symmetry for an angle of intersection of π/k. With these symmetries I map any point of the plane to the small sector between the lines containing the kaleidoscope.
This becomes easy if the intersection is at the origin and using polar coordinates. The mapping does not change the radius of the point. The angle ψ of the mapped point oscillates between 0 and π/k like a triangle wave with a period of 2π/k when the angle φ of the original point goes from 0 to 2π. Thus, in a first step I do the rotational symmetry with ψ=φ mod (2π/k). Then comes the mirror symmetry. For ψ>π/k I put ψ->(2π/k)-ψ.
To get the image of the kaleidoscope on the Poincaré disk I simply alternate this calculation with an inversion from the inside of the circle to its outside. This stops when the point lies inside the triangle of the kaleidoscope. But the resulting mapping has a discontinuous derivative at the mirror lines and at the inversion circle. This makes that sharp angles appear in the output image if the input image has straight lines and other artifacts. We can easily improve the image near the straight lines.
Without inversion at the circle we get a simple rosette. This is a typical result:
You can clearly see the discontinuities, especially the angles. We can improve and remove the discontinuities with an extra mapping that has a vanishing derivatives at the straight lines. In polar coordinates we can use a Fourier expansion of the triangle function of φ, as discussed in the earlier post “Better images from higher harmonics“. With the first three terms we get a smoother image with rounded edges:
There is another possibility. We can use the rosette mappings discussed earlier in “How to generate rosettes” and “Rosettes with mirror symmetry“. They are built on powers of exp(i k φ) and cause strong distortions destroying details of the input image. This is a typical example: