1. Introduction
A pattern is a generic term for any type of repeated, often regular, arrangement [
1]. It is also a design in which lines, shapes, forms, or colours are repeated. The repeated part is called a motif. A motif can be repeated and arranged in many ways to create different types of patterns. In regular patterns, the motif (or motifs) is repeated predictably [
2]. It could be the same each time, or it could change in regularly repeating ways. Motifs can be arranged in many ways to create a regular pattern. An irregular pattern is one in which the motif changes or the way it is repeated is unpredictable [
3]. How complicated a pattern is depends on what is repeated and the way in which it is repeated.
Before the invention of computers, patterns were generated by hand through drawings and many other skills. It takes a very long time to generate a single pattern, and sometimes, after all the labour, the pattern may not meet the requirements of the designer or the consumers. With the use of computers, it is easy to generate millions of different patterns in just a minute [
4]. In a bid to satisfy human wants, researchers have found out that patterns can be generated using mathematical equations or artificial intelligence methods.
In the literature, we can find various methods for generating patterns that use mathematical equations. Among the methods, a popular approach is the use of fractals, e.g., inversion fractals [
5] and Mandelbox [
6]. Furthermore, other non-Euclidean geometries are used in the generation of patterns. For instance, in [
7], the authors used spherical geometry, whereas in [
8], hyperbolic geometry was used. In the generation of patterns, not only various types of non-Euclidean geometries are used. Mathematical objects such as whirls [
9] or spirals [
10,
11] are commonly used in obtaining artistic patterns. Another group of methods are the methods that are based on the dynamics of discrete dynamical systems [
12,
13,
14]. Not only the dynamics but also the orbits of discrete dynamical systems can generate aesthetic patterns [
15]. Based on the results presented in [
15] and the orbit trap method [
16], Lu et al. in [
17] introduced a method that is the main subject of this paper, namely, the orbit trap method that generates patterns with wallpaper symmetry.
In this paper, we introduce modifications of the orbit trap method presented by Lu et al. in [
17]. The first modification relies on using the S-iteration [
18] instead of the Picard one that is used in the original algorithm. We also extend the parameters in the S-iteration from scalar to vector ones. Moreover, we propose the use of various metrics for defining orbit traps and introduce some new orbit traps. Additionally, we present examples showing that we can obtain a local fractal structure in the generated pattern when using an appropriate mapping and orbit traps.
The paper is organised as follows. In
Section 2, we briefly present the orbit trap method. Then, in
Section 3, we introduce modifications to the orbit trap method from
Section 2. Some examples showing the potential of the proposed modifications are presented in
Section 4. Moreover, we present examples showing the local fractal structure of some of the patterns. Finally, in
Section 5, we provide some concluding remarks and the directions for future work.
2. Orbit Trap Method
In [
17], Lu et al. introduced a method for generating artistic images with wallpaper symmetries. The method was based on the mappings for which the chaotic attractor possesses a wallpaper symmetry [
15] and the orbit trap method [
16,
19]. Moreover, they proposed a method for generating colour maps using an exponential function. In this section, we briefly present the method of Lu et al.
In general, in the method for each point in the considered area, we iterate a function starting from the point and check whether the transformed point falls into one of the orbit traps (orbit trap is a bounded area in the plane). When the point falls into one of the orbit traps, the point is considered to be trapped, and we end the iteration process. Next, a colour is assigned to the starting point based on the distance from the centre of the orbit trap to the trapped point. If the point is not trapped in the given number of iterations, then it gets a background colour.
To obtain images with wallpaper symmetry, we need to use a proper function that is iterated and some orbit traps. Lu et al. based their method on the functions introduced in [
15]. Depending on the symmetry type, we need to use different functions.
For the symmetry type p2, pm, pg, cm, pmm, cmm, pmg, pgg, p4, p4m, and p4g, we use function
of the following form [
15]:
where
. In [
15], Carter et al. derived conditions that the points
must satisfy to obtain each of the symmetry type. For completeness, we gather the conditions in
Appendix A.
To define functions for the p3, p3m1, p31m, p6, and p6m symmetries, let us firstly define the vectors [
15]:
and the following mappings:
Let us note that is a counter-clockwise rotation by , whereas is a counter-clockwise rotation by .
Moreover, for
, let us define [
15]
where
, and · is the dot product.
For each of the
vectors, let us arbitrarily select
, respectively. Now, for each of the p3, p3m1, p31m, p6, p6m symmetries, we define the
function in the following way [
15]:
p3 symmetry (
) and p6 symmetry (
)
p3m1 and p31m symmetries (
), and p6m symmetry (
)
where
The next thing that we need in the method are the orbit traps. Lu et al. in [
17] defined four orbit traps that were based on circles. We present them in
Figure 1. The centres
and the radii
for the circles in each case are the following:
- (a)
, ,
- (b)
, , , ,
- (c)
, , , , ,
- (d)
, , , , , , , .
The points in the orbit trap should be coloured according to some colour map. In [
17], a method for generating colour maps that is based on an exponential function was proposed. In this method, we have a set of base colours
, and for each of the base colours we assign a colour ratio
for
such that
. Moreover, we give the number of colours
in the colour map. The method for generating the colour map is presented in Algorithm 1.
Algorithm 1: Colour map generation. |
|
The pseudocode of the method introduced by Lu et al. in [
17] is presented in Algorithm 2. In this algorithm, the following notation
and
is used to denote the
x and
y coordinates of a point
. Moreover,
f is one of the functions given by (
1) or (
7) or (
8). Lu et al. in their paper set
,
for most of their examples.
When using the orbit trap method from Algorithm 2 to generate patterns with wallpaper symmetry, we need to point out one thing that was not mentioned in [
17]. Namely, the symmetry type of
f does not implicate that the generated pattern will be of the same symmetry type. We need to select a proper combination of the orbit traps and the type of the function
f to get a desired symmetry type. In
Section 4, we will present an example showing how the combination of the orbit traps and the function
f affects the resulting pattern and changes its symmetry type.
Algorithm 2: Orbit trap method. |
|
3. Modifications of the Orbit Trap Method
When we look at Algorithm 2, we notice that it uses a feedback process of the following form:
where
is a starting point. This type of feedback process is called the Picard iteration [
20], and it is used in various algorithms, e.g., polynomial root-finding using numerical algorithms [
21], generation of fractals [
5,
22], etc.
One of the most important applications of Picard’s iteration is finding the fixed points of a contractive mapping using Banach Fixed Point Theorem [
20]. For instance, this application allows for the generation of fractals given by iterated function systems [
23]. In fixed point theory, we can find many other iterations that are used to approximately find fixed points not only for contractive mapping but also for pseudo-contractive or non-expansive mappings [
20]. We will modify the orbit trap method presented in
Section 2 by replacing the Picard iteration with the so-called S-iteration, which was defined by Agarwal et al. in 2007 [
18].
Let
be a metric space,
be a mapping and
be a starting point. Then, the S-iteration is defined in the following way [
18]:
where
and
for all
. Let us notice that the S-iteration reduces to the Picard iteration if
and
for all
. Moreover, it reduces to the Picard–Mann iteration [
24] if
and
for all
.
To use (
11) in the orbit trap method, we need to specify a metric space and the mapping
T. We take the metric space
, where
d is any metric in
, and as the mapping, we take
given by the formulas introduced in
Section 2. In (
11), we use sequences of parameters
and
, but for simplicity we will use constant sequences, i.e.,
and
. The conditions about the range of the parameters in (
11) were introduced in fixed point theory to obtain convergence to a fixed point of the mapping. In the orbit trap method, we are not interested in finding fixed points. Instead, we are interested in generating interesting artistic patterns, so we can omit these conditions and take any real values. We can even go further and take
and
as two-dimensional points from
, but in such a case, we need to define multiplication in order to be able to perform calculations in the S-iteration. Thus, we define the multiplication in a similar way as for complex numbers, i.e.,
The last thing that we need to consider—if we want to use S-iteration in the orbit trap method—is the formula for
. In the orbit trap method, we generate patterns with wallpaper symmetry, so in each form of the
f function, we calculate the final result modulo
. Therefore, in the formula for
in (
11), we need to do the calculations modulo
.
The modified S-iteration that we will use in the orbit trap method has the following form:
where
is a starting point;
are parameters; and
is the mapping introduced in
Section 2. Let us notice that when the parameters
and
are of the following form:
,
, where
, then (
13) reduces to the S-iteration with scalar parameters
. Therefore, for
and
, iteration (
13) reduces to the standard Picard iteration.
Looking again at Algorithm 2 and the orbit traps presented in
Figure 1, we see that the circles forming the orbit traps are defined in a metric space in which we use the Euclidean metric. When introducing the S-iteration to the orbit trap method, we assumed that we take the metric space
, where
d is any metric in
. Thus, the circles will have different shapes for various metrics. In the rest of the paper, we will use three metrics defined in
[
25]:
-metric, where
Chebyshev metric (or
-metric)
Rickman’s rug metric
where
.
Examples of circles with centre
and radius 1 obtained with metrics (
14)–(
16) are presented in
Figure 2.
Besides the use of the S-iteration and various metrics for orbit traps, we also introduce three new orbit traps:
- (a)
, , ,
- (b)
, , , , ,
- (c)
, , , , , .
Figure 3 presents the new orbit traps obtained with the Euclidean metric.
In Algorithm 3, we present the pseudocode for the modified version of the orbit trap method. We can implement this algorithm on the GPU (graphics processing unit) using shaders instead of the CPU (central processing unit) implementation presented in [
17]. In the implementation, we render a quad that occupies the whole space in the window. Then, in the vertex shader, we calculate the coordinates of area corners and let the rasterizer calculate the coordinates of the starting point
, which will be an input variable for the fragment shader. In the fragment shader, we make all the calculations that start from line 6 in the algorithm. Moreover, to enhance the quality of the generated pattern, we can use multisampling to perform the anti-aliasing that was not used in the original method presented in [
17].
Algorithm 3: Modified orbit trap method. |
|
4. Examples
In this section, we present some examples of patterns obtained using the modified orbit trap method presented in
Section 3. In all examples, we use multisampling with eight samples per pixel to perform anti-alising for enhancing the quality of the generated patterns. The algorithm for generating the patterns was written in OpenGL Shading Language (GLSL).
In the examples, we use four colour maps generated using Algorithm 1. The maps are presented in
Figure 4, and the parameters used to generate them were the following:
,
, and the base colours together with the colour ratios are gathered in
Table 1.
In
Section 2, we mentioned about the proper combination of the orbit traps and the type of the function
f in order to get the desired type of wallpaper symmetry. Thus, the first example presents this property. In the example, we generate patterns using the same function
f but with various orbit traps that we introduced in
Figure 1 and
Figure 3. The obtained patterns are presented in
Figure 5, and the parameters used to generate them were the following: colour map from
Figure 4b, area
,
, Picard iteration (i.e.,
,
), Euclidean metric, function
f given by (
8) with p3m1 symmetry and
,
,
,
,
, and
. From the images in
Figure 5, we see that only
Figure 5a,c,g have the same symmetry type as
f, namely the p3m1 symmetry. All the other images have another type of symmetry, namely, the cm symmetry. When we look at the orbit traps used to obtain the patterns with p3m1 symmetry, then we notice that they have the same rotational symmetries and reflections as the p3m1 symmetry. Thus, to generate a pattern with a given symmetry type, the function
f and the orbit traps should satisfy similar symmetry conditions. Moreover, from this example, we can observe one more interesting thing. When we look at the orbit traps in
Figure 1c and
Figure 3b, we see that they are the same circles but rotated by
. However, if we look at the patterns generated using them with the same other parameters (see
Figure 5d,e), then we notice that the patterns are completely different. Thus, a modification of the orbit traps obtained by rotation could lead to a significant shape change of the resulting pattern.
In the next example, we present the effect of changing the metric used in the definition of the orbit traps. To show this, we fix orbit traps and change the metric and its parameter, i.e.,
p for the
metric and
for the Rickman’s rug metric. In the example, we use orbit traps from
Figure 3a, and the other parameters defining the pattern were the following: area
,
,
, Picard iteration (
,
in the S-iteration), colour map from
Figure 4c, and function
f given by (
1) with the cmm symmetry defined by the coefficients (we give only the non-zero elements of the matrix that defines (
1))
,
,
,
,
, and
. In
Figure 6, we show patterns obtained with the
metric with the following values of
p: (a)
, (b)
, (c)
, (d)
, (e)
, and (f)
∞, whereas in
Figure 7, we see patterns generated using Rickman’s rug metric with the following values of
: (a)
, (b)
, (c)
, and (d)
. The image from
Figure 6c was obtained with the Euclidean metric that was used in the original method presented in [
17]. It will serve as a reference point. When we increase the value of
p over
(
Figure 6d–f), we see that some of the areas of the pattern are gradually smooth out. This change is continuous, and the smoothing becomes bigger with the increase of the
p value, obtaining in the limit the pattern presented in
Figure 6f. When we decrease
p below
and tend to
(
Figure 6a,b), we see that more details appear in the pattern compared to the pattern obtained with the original method. If we look at the images obtained with the Rickman’s rug metric, then we can also notice a smoothing effect with the decrease of the
value. However, some other details are smoothed out compared to the
metric. Therefore, we see that with the use of various metrics, we can obtain very interesting patterns that were not possible to obtain with the Euclidean metric.
The next two examples show the use of the S-iteration. In the first example, we use S-iteration with scalar parameters and , which corresponds to the case in which we vary the x coordinate and take of the parameters. In the second example, we use S-iteration, in which the parameter is fixed and the parameter has fixed x coordinate and varying y coordinate.
In the first example with the S-iteration, we generate patterns for scalar values of the iteration’s parameters, i.e., the parameters are of the form
,
, where
. The generated patterns are presented in
Figure 8, where the following parameters were used in the generation process: orbit traps from
Figure 3b with Euclidean metric, area
,
,
, colour map from
Figure 4a, and function
f given by (
1) with the p4m symmetry defined by the coefficients (again we give only the non-zero elements of the matrix)
,
,
,
,
,
,
,
,
,
,
, and
. From the images, we see that by changing the scalar values of the
and
parameters in the S-iteration, we are able to generate a great variety of patterns. The shapes of the patterns can be very simple, as in
Figure 8a, or very complex, as in
Figure 8d.
In the second example, with the S-iteration, we generate patterns in which we vary the
y coordinate of the
parameter, and the other parameters are fixed. In this way, we show that not only scalar parameters generate interesting patterns but also the vector parameters. In the example, we used the following parameters:
in the S-iteration, orbit traps from
Figure 1c with Euclidean metric, area
,
,
, colour map from
Figure 4d, and function
f given by (
1) with the p4 symmetry defined by the coefficients (again we give only the non-zero elements of the matrix)
,
,
,
,
,
,
,
,
,
,
, and
. In
Figure 9, we see patterns generated with the following values of the
parameter: (a)
, (b)
, (c)
, and (d)
. Similar to the scalar case, when varying the
y coordinate of the
parameter, we are able to obtain a great variety of patterns. The generated patterns vary not only in shape but also in colouring. In
Figure 9, we see a greater variety of colours than in
Figure 8.
In the end, we present an interesting observation. When using orbit traps in which we have an empty space in the neighbourhood of the origin that is surrounded by the orbit traps (see orbit traps in
Figure 1b,c and
Figure 3b) and function
f with compatible symmetry type, then in the area near the origin of the generated pattern, we find self-similar structures. Thus, the patterns have a local fractal structure. To observe this, in
Figure 10, we present magnification of the central part of the patterns from
Figure 5c,
Figure 8c and
Figure 9a. If we magnify these areas further, then we get the same images repeatedly, so we clearly see the local self-similarity property.