further wallpapers for hyperbolic space

An equilateral triangle gives us a kaleidoscope of three-fold rotational symmetry. With a square we get two-fold rotational symmetry. Would reflection at the sides of other regular polygons too give periodic images with rotational symmetry ?

To get an h-fold rotational symmetry at a corner we need an angle of 180°/h between the sides meeting at the corner. This is not possible for polygons with more than four corners in Euclidean space because they would have angles of more than 90°. However, in hyperbolic space the corner angles can have any value smaller than (1-2/k)180°, where k is the number of corners of the polygon and the limit results from Euclidean geometry.

We use the Poincaré disc model for hyperbolic geometry. You can find a very interesting detailed discussion at http://www.malinc.se/math/noneuclidean/mainen.php. The most important facts are: An open disc represents the infinite hyperbolic space in our Euclidean space, straight lines in hyperbolic space become circles that intersect the boundary of the disc at a right angle and the inversion at these circles is equivalent to the mirror image at the straight lines in the hyperbolic space.

A regular polygon that has its center at the center of the Poincaré disc shows its dihedral symmetry in our Euclidean drawing plane. Its sides are arcs of equal width and they belong to circles of equal radius. These circles are straight lines in hyperbolic space. The angle between the two arcs at a corner is simply the angle between their tangents. Using basic trigonometry we get their radius from the desired value 180°/h for the angles, the number k of corners of the polygon and the radius of the Poincaré disc. This defines the reflection at the sides of the polygon as inversions at the circles bearing the arcs. Thus we get an easy generalization of the usual regular polygon with straight edges.

As in the earlier posts, we have to map points of the Poincaré disc into the polygon using reflections at its sides. The symmetries of the regular polygons make this easier than for triangles. As long as the point lies outside the polygon we use inversion at the circle with the arc that lies closest to the point. The required number of inversions increases going to the border of the Poincaré disc and finally diverges at its border. Thus we have to impose an upper limit and disregard points that take too many inversions.

We rapidly find the circle to use for inversion using a coordinate system with its origin at the center of the Poincaré disc and polar coordinates. A polygon with k corners has its corners at polar angles of i*(360°/k) where i goes from 1 to k. The sides of the polygon are arcs connecting the two corners at angles i*(360°/k) and (i+1)*(360°/k). Now, if the point that we are mapping has a polar angle φ we have to find the arc that covers this angle. Thus we have to find an integer number i with i*(360°/k) < φ < (i+1)*(360°/k), all obviously modulo 360°. This defines the arc that is closest to the point. It is part of a circle which has its center at the polar angle (i+1/2)*(360°/k). If the point lies outside this circle then it has to be inside the polygon and we can get the colour for the pixel at the starting point from an input image at this mapped position. If the point lies inside the circle we invert it at the circle and repeat this procedure.

For a pentagon with angles of 90° we get a result with this structure:The original pentagon is shown in yellow. All points that need an odd number of inversions are coloured light blue and those with an even number are shown dark brown. Away from the center we see strongly distorted pentagons, shrinking towards the border of the disc. But in hyperbolic space, they are all regular pentagons of the same size, tiling the hyperbolic plane. Actually, we get tilings for all k>2 and h>1. They are made of regular polygons with k corners and each corner belongs to 2*h polygons.

Using an asymmetric input image for the pentagon at the center we get kaleidoscopic images that look like this one:It has five different motifs of two-fold rotational symmetry, one for each corner of the pentagons. Often, such images seem to lack any order. Here we see strips of repeating green swirls with mirror symmetry. In hyperbolic space they are straight infinite friezes with horizontal and vertical reflection lines resulting from the mirror symmetries at two corners of the pentagon. These friezes are separated by narrow branching lines of lighter colour.

With an input image of rotational symmetry we get wallpapers with the same rotational symmetry if the symmetry is compatible with the polygon. The same pentagon as before and a rosette with five-fold symmetry gave this:Note that an input image with dihedral symmetry would give the same image as a kaleidoscope using the (5,2,4) triangle instead of this pentagon. In general, a regular polygon with k corners and angles of 180°/h using an input image of k-fold dihedral symmetry is equivalent to using a Möbius triangle (k 2 2*h) with corner angles of 180°/k, 90° and 90°/h.

For more images of higher resolution have a look at my Flickr album “hyperbolic wallpapers”.

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

How to program fast kaleidoscopes

This post repeats parts of earlier posts but I am trying to expand the ideas and explain them better. First, I am showing you how to make rosettes with rotational symmetry and mirror symmetry. This is easier than making kaleidoscopic images, but uses the same principles. Further, it is an important step in efficient programs for kaleidoscopes.

Let’s have two straight lines that intersect and divide the plane into four sectors. We use one of the sectors with an acute angle between the lines at its apex. This angle has to be a unit fraction of 180°; thus its value is 180°/k where k is an integer number greater than 1. We can then use mirror symmetries at the two lines to get a non-overlapping covering of the plane by images of this sector. This seems to be trivial as we can create a symmetric image by cutting out such a sector from an input image with scissors. We would then make copies of the sector and of its mirror image and glue these pieces together to cover the plane. Here is a typical result with green lines at the border of the sector cut out from the input image. Its copies are shown in bleached out colours:How do we program a computer to create such images efficiently? We have to find a colour value from an input image for each pixel depending on its position. Because the mirror symmetries make a non-overlapping covering of the plane by copies of the sector we can map the position of the pixel into this sector using these symmetries. We use this unique mapped position to read a colour from the input image which determines the colour of the pixel. Fortunately we do not need to find the detailed sequence of mirror symmetries as it is difficult to figure out. Instead we use that the two mirror symmetries generate a dihedral group which combines a k-fold rotational symmetry and k mirror axis. You can discover the elements of this group in the above picture.

We choose a coordinate system with its origin at the intersection of the two lines and an x-axis parallel to one of the mirror lines. Using polar coordinates (r,φ) for the position of a pixel, we have to map it into the sector with the same value for r and a new angle φ<180°/k. As a first step we use the k-fold rotational symmetry. The image is thus a periodic function of φ with a period length 2π/k and we can replace φ by its rest φ-2π/k*⌊φ/(2π/k)⌋. Then 0<φ<2π/k. Be careful, the modulo operation of some programming languages might result in something different for negative φ and you better use the universal floor function. The second step is a mirror image and it is only needed if φ>π/k. In this case we put φ->(2π/k)-φ. This gets us rapidly the mapped point in the small sector for any pixel without bothering about sequences of mirror symmetries.

A kaleidoscope uses a triangle. We get it with a third line that cuts across the sector that generated the rosette. Again the angles are unit fractions of 180°. Three numbers (k m n)  characterize the triangle. They are larger than 1 and the angles of the triangle are 180°/k, 180°/m and 180°/n. Such triangles are known as Möbius triangles, which are special cases of Schwarz triangles. The mirror symmetries of the two lines meeting at a corner make k, m or n-fold rotational symmetries in the same way as for a simple rosette. The three mirror symmetries at the three sides of such a triangle generate a larger triangle group. Applying these mirror symmetries on the triangle we get a non-overlapping covering of the plane.

The result differs strongly if the sum of the three angles (1/k+1/m+1/n)*180° is smaller, equal or larger than 180°. Our drawing plane is flat and has no curvature. Thus the sum of the angles of a triangle made of straight lines is equal to 180° and (1/k+1/m+1/n)=1. This equation has only three solutions. With the numbers (4 2 4) we get a triangle having two 45° angles and a right angle. As a kaleidoscope it makes a periodic image with two distinct 4-fold rotational symmetries and a two-fold rotational symmetry. Then (3 3 3) give an equilateral triangle and periodic kaleidoscopic images with three distinct centers of three-fold rotational symmetry. The last triangle results from (6 2 3) and has 30°, 60° and 90° angles. This kaleidoscope has periodic images with 2, 3 and 6-fold rotational symmetries. For some images of these kaleidoscopes see my earlier post “Geometry of kaleidoscopes with periodic images“. Again, we have to find for each pixel the related the unique point in the basic triangle resulting from the mirror symmetries. We only care about the result and use that the image is periodic. In a first step we map the position of the pixel into the periodic unit cell. Then, depending on the position in the unit cell we use some of the mirror symmetries to map the point into the basic triangle. Obviously, this is really fast and needs only a few simple steps. On the other hand, the periodic lengths and mirror symmetries are different for each kaleidoscope and we have to program a different mapping function for each kaleidoscope. This too is expensive and inconvenient.

Is it possible to make a single efficient mapping procedure that works for all three cases? To do this we treat the three mirror symmetries differently as shown in this image for a kaleidoscope with a (6 2 3) triangle:As for the rosette, two mirror lines (shown in green) make a dihedral symmetry group around their point of intersection. The third line (shown in red) of the triangle adds an extra mirror symmetry. The triangle cut off from the input image is shown in full colours and its copies are bleached out. To map any point into this triangle we use an iterative procedure of two steps as indicated in the figure by the blue dots and arrows. First, the dihedral symmetry maps the point into the sector between its two mirror lines. Then, if the point is still not inside the triangle we apply the mirror symmetry at the third line. These steps are repeated until the point goes inside the triangle. The example shown above used two iterations. You can see that each iteration reduces the distance between the point and the origin. Thus this iterative procedure should generally terminate and give a solution. It is very fast, versatile and easy to program. To be safe we have to limit the number of iterations used for mapping a point. The number of iterations needed for mapping a point into the triangle increases with its distance from the origin. Thus the maximum number of iterations determines the size of the resulting image and affects its border.

If the sum of the angles of the triangle is not 180° we can still use the same iterative procedure. Two sides of the triangle are still straight lines making up the dihedral symmetry and we only have to replace the third straight line by a circle. This makes it possible to have any angles of intersection between the straight lines and the circle because we are free to choose its radius and center.

We have to replace the mirror symmetry at the third line by an inversion at the circle. A circle of radius R with its center at position c inverts a point p into an image point q=c+(pc)*R²/|pc|². This inversion at a circle is very similar to a mirror symmetry. Very close to the circle the inversion gives the same results as a mirror symmetry at a tangent line. The inversion does not change local angles of intersection between lines. Actually, looking only at a small region the inverted image is similar to the original as only its orientation and size changes. At a larger scale inversion causes distortions and bends straight lines. These are important differences to mirror images that have the same size as the original and that leave straight lines intact.

We have to know that the inverted images of circles and lines are circles and lines too, but usually with a different radius. Only circles and straight lines that are perpendicular to the circle do not change upon inversion, as in this figure:The blue and red circles intersect at a right angle. An inversion of the disk bounded by the blue circle at the red circle yields again the same disk and every point outside this disk stays outside. The area of intersection between the two discs is shown in orange colour. Inversion maps it into the area inside the blue circle and outside the red circle, which is shown in green. This property of inversion is important for analyzing kaleidoscopic images.

If the sum of angles of the triangle is less than 180° we get an image with hyperbolic geometry. As an example let us look at the kaleidoscope resulting from the (5 2 4) triangle. It has 5, 2 and 4-fold rotational symmetry resulting from its angles of 36°, 90° and 36° with a sum of 171°. This is an example image:

As before, the triangle cut out from an input image is shown in full colour and its copies are bleached out. The triangle has two straight lines as sides, shown in green. They generate a dihedral symmetry with five-fold rotational symmetry for the image. The third side of the triangle is a part of the circle shown in red. As mentioned above, we use the same iterative procedure as for triangles with three straight edges. Using the dihedral symmetry we map points outside the triangle into the sector containing the triangle. Note that the triangle lies outside the circle. Thus, if the point is inside the circle we invert the point at the red circle. If this does not map the point inside the triangle we repeat these mappings.

Using enough iterations, all points inside the blue circle are mapped into the triangle. The blue circle has its center at the intersection of the green lines and is perpendicular to the red circle. Inversion at the red circle does not map the points outside the blue circle into the blue circle. These points would thus never reach the triangle and they have to be disregarded. The image of this kaleidoscope fills only the inside of the blue circle. It is a decorated Poincaré disc model for hyperbolic space.

The number of iterations increases for points that are closer to the blue circle and becomes infinite at the circle. Thus we need to limit the number of iterations. If this limit is too small we would get a rough outer border for the image. But fortunately, only few pixels take a large number of iterations and we can use a very large limit, such that the border appears to be a smooth circle.

If the sum of angles of the triangle is less than 180° we get an image with elliptic geometry. As an example let us look at the kaleidoscope resulting from the (4 2 3) triangle. It has 4, 2 and 3-fold rotational symmetry resulting from its angles of 45°, 90° and 60° with a sum of 195°. This is an example image:

This is very similar to the hyperbolic images discussed above, except that the red circle making up the third side of the triangle now contains the triangle itself. We can use the same iterative procedure as before but now we invert the point at the circle if the point lies outside the circle. This procedure maps every point into the triangle with only a few iterations. The resulting images are stereographic projections of decorated regular tilings of a sphere.

For more images of higher resolution have a look at my Flickr album “kaleidoscopic”.

 

 

 

 

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

Elliptic kaleidoscopes

In “further hyperbolic kaleidoscopes” I used two straight lines and a circle to make a triangle that defines a kaleidoscope. For k,n and m-fold rotational symmetries at its corners, the sum of its three angles is π(1/k+1/n+1/m). If this sum is larger than π we have to use elliptic geometry. For (1/k+1/n+1/m)>1 the point of intersection between the two straight lines always lies inside the circle that closes the triangle. We can do the same calculation as for the hyperbolic kaleidoscopes, but now we have to use the circle inversion to map points outside the circle to its inside. The circle is bent towards the outside and acts a bit like a magnifying concave mirror.

There are only a few choices for k, m and n that give elliptic kaleidoscopes. For m=n=2 we can use any value for k that is larger than 1. The center of the circle lies at the intersection of the straight lines and the circle crosses the straight lines at right angles. This gives us rosettes with the same symmetries as discussed earlier in “combinations of mirror symmetries“. But now we use explicit inversion at the circle instead of symmetric mapping function. Thus there is not a hole at the center and less distortion. A typical result looks like that:

More interesting are the remaining kaleidoscopes. They have the same symmetry as the tetrahedron, the octahedron and the icosahedron. An octahedron has a four-fold rotational symmetry at its corners, where four triangles meet. At the center of the triangles we have a three-fold and at the middle of its edges a two-fold rotational symmetry. A corresponding kaleidoscope has the same symmetries. It generates a stereo-graphic projection of a sphere with octahedral decoration as shown in this image:

The yellow triangle is the basic kaleidoscope. The dark brown triangles are its images with an odd number of reflections and inversions and images resulting from an even number are light blue. This is a typical image of this kaleidoscope:

There is a five-fold rotational symmetry at the corners of an icosahedron. The corresponding kaleidoscope has five-, three- and twofold rotational symmetries. The petals of a rose waterlily flower gave this result with icosahedral symmetry:

A tetrahedron has a three-fold rotational symmetry at its corners. A kaleidoscope with tetrahedral symmetry thus uses a triangle with three-fold rotational symmetry at two of its corners and a two-fold rotational symmetry at one corner. Its images look like this one:

 

Posted in Anamorphosis, Kaleidoscopes | Tagged , , , , | 2 Comments

The rotational and mirror symmetry at the center

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:

This gives kaleidoscopic images like this one:

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:

At first sight this is a disappointing mush.  To my surprise I got nevertheless interesting kaleidoscopic images, such as this one:

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

Further hyperbolic kaleidoscopes

In the last post I have used reflections at two parallel lines and a circle to get a Poincaré plane that shows a periodic decoration of hyperbolic space. What happens if the straight lines are not parallel and intersect? Then their mirror symmetries do not generate translations, instead we get rotations around their point of intersection. Thus together with the inversion at the circle we now have a Poincaré disk.

The two straight lines and the circle make a hyperbolic triangle, which we use as a kaleidoscope. We get a k-fold rotational symmetry if π/k is the angle of the intersection between the lines. As in the last post n- and m-fold rotational symmetries arise at the corners between the circle and the lines for angles of π/n and π/m. The sum of these three angles is π(1/k+1/n+1/m), which has to be smaller than π for hyperbolic space. Thus the condition 1/k+1/n+1/m<1 limits the choices for the rotational symmetries.

Now let us compare this with the usual Euclidean space. The sum of the angles is then equal to π and 1/k+1/n+1/m=1. Up to irrelevant permutations there are only three solutions with integer numbers of this equation. They are (k,l,m)=(3,3,3), (4,2,4) and (6,2,3). You can see the resulting kaleidoscopes in my earlier post “Geometry of kaleidoscopes with periodic images“.

To get a kaleidoscope for hyperbolic space we simply increase some numbers. An interesting choice is (k,n,m)=(5,2,4). The resulting Poincaré disk looks like this:

Here the yellow triangle is the inside of the kaleidoscope. Dark brown triangles show images with an odd number of reflections and light blue is for even number of reflections. The borders between triangles are circles with a right angle to the border of the disc. These are straight lines in hyperbolic space. Note that this is a periodic tiling of hyperbolic space with five-fold rotational symmetry.

And now for some images. From (5,2,4) I got this:

And the (4,3,3) kaleidoscope gave that:

The circle seems to act like a convex mirror and reduces the apparent size of the reflected images in the Poincaré disc. But actually, inversion at the circle is not the same as true optics and in the hyperbolic space all images have the same size. If you zoom in at the border you will see essentially the same image. Only the radius of the disc appears to increase in comparison to the distance between images. In the end we approach a Poincaré plane. The kaleidoscopes of the last post are thus actually limits of the kind (∞,n,m).

Note added on the 16 December 2017: These kaleidoscopes use Möbius triangles, which are Schwarz triangles with integer rotation number. Reflections at the sides of a Möbius triangle generate the triangle group and make a tiling of an elliptic, Euclidean or hyperbolic plane.

 

 

 

 

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

Variations on the hyperbolic kaleidoscope

In the last post I have presented a hyperbolic kaleidoscope with two- and three-fold rotational symmetries. Could we have other rotational symmetries?

Yes, we simply move the vertical lines! To get an n-fold rotational symmetry the circle has to intersect a straight line at an angle of π/n. The distance between the line and the center of the unit circle is then cos(π/n). We can freely choose the rotational symmetry at the left and at the right of the unit circle as long as the sum of the angles of the kaleidoscopic triangle is less than π.

Here is an example with 2- and 4-fold rotational symmetry:

And here comes a symmetric kaleidoscope with two 3-fold rotational symmetries:

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

A hyperbolic kaleidoscope

In “creating symmetry” Frank Farris shows a wallpaper for hyperbolic space. He uses the Poincaré plane to project the hyperbolic space to our Euclidean drawing surface. The wallpaper then results from mirror symmetries at vertical lines at x=0 and x=0.5 together with inversion at the unit circle. The mirror symmetries generate a periodic drawing in x-direction with periodic length 1. The inversion at the circle makes an increasingly complex design going from above to the x-axis. This is an example I created:

Farris uses algebra and group theory to discuss the structure of these images. To me this is fascinating and challenging. To see if I really got it I tried to explain these images using geometry.

First, the most important properties of hyperbolic space: The Poincaré plane occupies the upper half plane. Equal distances in the hyperbolic space seem to shrink going to the x-axis because of the projection. A particle with constant speed in the hyperbolic plane would never reach our x-axis. Thus the x-axis is infinity far away in the hyperbolic plane. Straight lines of the hyperbolic space are projected as circles in the Poincaré plane. Their centers lie on the x-axis. If the radius of the circle goes to infinity we get a straight vertical line. A mirror images at a straight line in hyperbolic space becomes an inversion at the corresponding circle in the Poincaré plane. Note that the inversion at a circle maps circles into circles. It has to be like that, because straight lines in the hyperbolic plane have straight lines as mirror images. Similarly, inversion at a circle preserves the angle between intersecting circles.

I have drawn the two vertical lines and the unit circle in another image of the same symmetries:

Note how the vertical lines generate the mirror symmetry and periodicity in x-direction. At the point (0,1) the circle intersects the vertical line at a right angle. Thus we get a two-fold rotational symmetry with mirror symmetries at this point. Going away from this point distortions set in. Repeated copies lie at the line y=1, which is not a straight line in hyperbolic space. Inversion at the unit circle maps this line into a circle of radius 0.5 with its center at the point (0,0.5). Thus images of this center of two-fold rotational symmetry appear on this circle. The first one is at (0.5,0.5). At (0.5,0.866) there is an intersection angle of 60 degrees between the vertical line and the unit circle. This makes a center of three-fold rotational symmetry. Again, copies appear on a horizontal line and on circles.

Let us compare this with kaleidoscopes in Euclidean space, as discussed in “Geometry of kaleidoscopes with periodic images“. In general they have three straight lines that serve as mirror axis and form a triangle. Reflections of its inside cover the plane. Thus the kaleidoscopic image arises. Here we have something similar. The two straight lines and the circle make a triangle in the hyperbolic space if you accept that the parallel lines meet at infinity with a vanishing intersection angle. Again, we can use mirror symmetry and inversion to cover the plane.

To show the structure more clearly I filled the basic triangle region with a dark brown color. Each reflection or inversion switches the color from dark brown to light blue or inversely. In the resulting image we can easily see the different images of the basic region:

Look out for centers of two-fold and three-fold rotational symmetries. How are they mapped by the inversion at the unit circles?

I have created my images using iterated reflections of points and not with symmetric bundles of wave function as Farris. Thus I get discontinuities in the first derivative of the images and my images are not so smooth at the unit circle. But I can generate images much faster and easily. Thus I can rapidly change the elements of symmetry.

 

 

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