Abstract
This paper presents a morphological study of Islamic geometric patterns (IGP) and their role in application of formal grammar in computational modeling of IGPs. Through a comprehensive literature review and data collection, we analyze the morphological properties of these patterns using techniques such as geometric transformations, pattern classification, and symmetry analysis. Based on our findings, we explore how these properties can be used in constructing a formal grammar through string rewriting system for a CAD application. Building on a study on the potential of a string rewriting system for modeling IGPs, the current research suggests an update to the previous system and introduces a new morphological structure for IGPs. The new method has an expanded sample set and is tested on a class of 5-fold star patterns with 12 members and demonstrates successful development. The results are implemented in a Grasshopper add-on, providing a flexible platform to generate the patterns through strings and to control their parameters. This tool opens up new possibilities to bridge traditional patterns with contemporary technologies and make them more accessible. Furthermore, it contributes to the preservation of IGPs as a significant cultural and architectural heritage, while also advancing the evolution of these patterns to a new and contemporary generation.
Keywords
Introduction
Tessellation, or an arrangement of shapes on a surface, which fills the surface without any gap between those shapes, is a technically efficient and aesthetically impressive solution to cover a crude surface. Islamic geometric patterns (IGP) are a category of tessellation, which use certain geometric shapes to produce a variety of patterns.
This research aims to answer the question of how to use formal grammar for generating fivefold Islamic geometric patterns in Computer-Aided Design (CAD) tools. Specifically, the research investigates the morphological principles underlying these patterns and provides a formal grammar-based approach to automate their generation. This can facilitate the creation of more intricate and diverse Islamic art and architecture, while preserving the underlying principles and aesthetics of these patterns.
By analyzing the patterns’ underlying structures and rules, we aim to provide a better understanding of their geometric properties and enable their integration into CAD applications. Our results demonstrate the potential of formal grammar in generating a variety of fivefold Islamic geometric patterns, which can be used to enrich the aesthetic value of contemporary design.
Available studies conducted by other scholars, majorly aim to investigate three main domains: 1. Discovering the original methods of generating traditional IGPs; 2. Developing new patterns using the rules of the old ones; and 3. Introduce these patterns to the computational tools. Considering the fact that there is already a strong body of research in first criteria and several attempts on the second one, this article by using the experiences in first and second domain, targets the last criteria in order to 1. Contribute to preservation of this significant cultural heritage; and 2. Open up new possibilities for generating new patterns within the methodology.
Digital generation of IGPs can confront several challenges. Firstly, there is a lack of standardized and comprehensive documentation of these patterns, which can make it difficult to study them accurately and reproduce them digitally. 1 Secondly, due to the intricate nature of these patterns, this action can be time-consuming and need a high level of precision and attention to detail in their digitalization. The complexity of these patterns can make it difficult to develop a suitable algorithm or programming language to generate them and require advanced computational skills. Finally, the cultural significance and historical context of these patterns must be considered, and there is a risk of oversimplifying or distorting their meaning and significance when reducing them to digital models.
There are several reasons why there is a lack of standardized and comprehensive documentation of Islamic geometric patterns. One reason is that the patterns have been traditionally passed down orally and visually from master craftsmen to apprentices, which has made it difficult to preserve and transmit the knowledge over time. Additionally, Islamic geometric patterns have been produced in a wide range of cultures and contexts throughout history, which has resulted in variations and adaptations of the patterns that have not always been documented. Furthermore, the use of these patterns has evolved over time, and many of their original functions and contexts have been lost or forgotten.
By utilizing formal grammar methodology rather than original generating methods, the emphasis of pattern generating shifts from geometrical drawing to morphological structure. This shift allows for the development of a generating system based on machine language, consisting of a set of rules and constraints that simplifies the design process and liberates it from complicated geometric methods. Moreover, a standardized and shareable approach to digital IGP generation can be established, making it easier to collaborate and reproduce these patterns. As a result, designers and researchers can systematically and consistently generate digital IGPs, reducing the time and effort required for their digitalization.
To gain an insight into the morphological analysis of the Islamic geometric patterns, in the next section, we will briefly review various approaches to understand the geometrical structure of IGPs.
IGPs and their morphology
Comprehending the embedded geometrical techniques of IGPs has been a persistent challenge for researchers since their inception. Answering the questions like how these patterns in the first place originated is not simple. Historically the methods to produce IGPs have been kept as a professional secret between a master and a few of his apprentices. As a result, there is not enough evidence like treatises or drawing notebooks to explain the traditional construction methods of these patterns. Scholars like Chorbachi 2 and NecipOglu 3 bring up a few documents like scrolls and manuscripts. However, these documents do not provide a comprehensive understanding of this subject.
In 1879, Bourgoin 4 published a large collection of IGPs and their sub-grids, which he believed that they are the initial driver for those patterns. His book was a pioneering work in offering personal analysis on IGPs and later Kritchlow, 5 Wade, 6 and El Said and Parman 7 published similar analysis. Salman and Abbas 8 believe that these methods, which are offered by the mentioned scholars, are unnecessarily elaborated, and offer no explanation as to how the patterns have evolved. Instead, they suggest a logical framework for the understanding of the origin and evolution of IGPs. They discuss that the most practical way to produce any pattern is starting with basic shapes. Later comes, patterns from overlapping shapes, patterns from geometrical construction on familiar shapes, and patterns on concealed grids.
The final approach to discuss about are methods based on the group theory, which explain the structures of these patterns over a mathematical basis. In this approach symmetric patterns can be analyzed into seventeen different types and identify the minimum amount of information needed to generate a particular symmetry type. Many scholars have benefited from this method, particularly to generate IGPs digitally. In 1987 Grunbaum and Shephard 9 derive a meticulous method to analyze periodic patterns in symmetric groups. However, he does not extend his studies to IGPs. In 1992 Abas and Salman 10 use the group theory method to develop an algorithm for study of IGPs. Ostromoukhov 11 extended Abas and Salman's analysis to introduce systematic guides for the designers to construct patterns. Still, his method is focused on only two families of symmetries, which is widely used in Moorish art. Later in this paper, we will use Grunbaum–Shephard and Ostromoukhov approach, from a different point of view, as a basis for our morphological study, which serves to reach a formal grammar for IGPs and cover the production of a wider range of patterns.
Parallel to the reviewed methods, in 1925 Hankin 12 reveals an archaeological observation about some drawings of geometric patterns in a Turkish bath in India, which had a polygonal grid beneath the main pattern. Based on that he proposes a method, called polygon in contact, which can explain a large family of IGPs. Lee 13 in 1987 develops Hankin’s polygons-in-contact technique. He illustrates that a pattern can be extended by drawing pieces of lines from the middle of the tiling edges. Later Bonner 1 focuses on this notion and provides an elaborated collection of IGPs, which can be constructed through this methodology. Although this approach can explain a set of known patterns, however, in some cases finding the polygonal grid is as complicated as the main pattern. In collaboration with Bonner, Kaplan develops an algorithm to produce IGPs on computer and parametrize them. Kaplan and Salesin 14 developed a set of tools, called Najm, to produce star patterns, which let designers explore the design space of IGPs.
There have been several attempts to design a framework to code IGPs and provide digital and parametric models. The most successful ones with more degree of freedom (to parametrize and amount of patterns to cover) are based on group theory and symmetry families like Kaplan algorithm. Aljamali et al 15 criticize this approach for classifying IGPs and argue that from this perspective, the core characteristics of the IGPs, which are the attributes of the unit pattern, are neglected. They concentrate on smaller units on the motif, gridding, and geometric attributes and accept symmetry groups as an arrangement tool. They use this notion to present an IGP Designer tool. On the other hand, Khamjaneh 16 accepts the group theory and concentrates on producing an algorithm for the template motif of the pattern. His examples are classified based on group symmetry, and the template motifs are constructed based on continuous strands. Later in this research, we will utilize the capacities of continuous strands to code IGPs.
The developed digital tools, which were discussed before, are not widely accessible for general users or had been terminated during the time. As a result, we were not able to evaluate their application. However, Kaplan’s algorithm has been used in platforms like Rhinoceros–Grasshopper to develop tools for producing IGPs and benefit from its parametric capacities.
Another substantial approach to analyze IGPs is shape grammar. Shape grammar is a system of shape production based on an axiom shape and one or more transformation rules. This theory was introduced by Stiny and Gips 17 in 1972 for the first time. Although their focus was not on geometric patterns in particular. They extensively define frameworks for using shape grammar to be used as a shape production system. Cenani 18 uses the shape grammar to explore new design possibilities to produce IGPs. He extracts basic shapes of one class of patterns and applies a production rule to generate new patterns. Ulu and Sener 19 also use shape grammar to analyze penrose pattern and to apply it on modeling decagonal IGP patterns. Another attempt to use shape grammar method on generating IGPs is done by Sayed, Ugail et al 20 which more than everything is about 3D application of IGPs.
The last approach which is topic of this research is implementation of formal grammar and rewriting system to generate IGPs. Here it is important to explain the difference between formal grammar and shape grammar. Formal grammar and shape grammar are two different approaches to describing and generating patterns in various fields such as linguistics, computer science, architecture, and art. Formal grammar, also known as formal language theory, is a mathematical framework for describing the structure and rules of formal languages. These languages are often used in computer science and linguistics to describe programming languages, natural languages, and other symbolic systems. Formal grammars typically consist of a set of production rules that specify how symbols can be combined to form valid sentences or expressions in a language. Shape grammar, on the other hand, is a specific type of formal grammar that is used to describe the rules and constraints that govern the generation of visual or geometric shapes in architecture and design. 21 Shape grammars typically consist of a set of rules that specify how basic shapes can be combined and transformed to create more complex forms, such as architectural units. While both formal grammar and shape grammar use formal languages and production rules to describe and generate patterns, the main difference between them is in their application. Formal grammar is used more broadly to describe any kind of symbolic system, while shape grammar is specifically tailored to generating visual or geometric forms.
A string rewriting system, also known as a string grammar or a production system, is a formalism used to generate strings or sequences of symbols through a set of production rules. It is a type of formal grammar that operates on strings of symbols, typically characters or words. In a string rewriting system, a starting string is transformed into a new string by repeatedly applying a set of production rules. Each rule specifies a pattern to be replaced and a replacement string. When the pattern is found in the starting string, it is replaced with the corresponding replacement string. This process is repeated until no more rules can be applied or until a desired target string is reached. String rewriting systems are particularly useful in computer science for generating programming code. String rewriting systems have been used limitedly in the generation of Islamic geometric patterns. In the next section we will discuss this scope.
Formal grammar and Islamic geometric patterns
Formal grammar theory primarily is the application of formal language to define syntactic rules or internal structure for complex objects. Formal language, which first time was introduced in 19 centuries, is an application of a set of strings via certain rules. For instance, in formal language L over a set of alphabets Σ, there is a subset of words, which are constructed through the permitted syntax into the language. If the same alphabet in a language does not match with rules, they are not recognized as part of this language. Formal grammar defines these rules for accepted forms within a language. It mainly was used to formulate linguistics, arithmetic, and logic arguments. Very soon, the capacity of formal language in other fields like computational graphics was noticed.
The rewriting system is a method to define formal grammar and firstly it was given a wide interest in the late 1950s by Chomsky’s work on formal grammar. He applied the concept of rewriting to describe the syntactic features of natural languages and formulated the classic systems of formal grammar. 22
As we mentioned, the aim of formal grammar is to determine a production system based on a set of strings and rules. In the rewriting method, it starts with an axiom string and a set of rules to replace any determined strings of axiom with another string. The order of applying the rules and the stop point depends on the grammar system that is in use. For instance, in Chomsky grammar, it is not possible to use the rules in parallel and simultaneously but in L-system, they can be applied with any sequence. 23
The first graphical equivalents of formal grammar can be observed in Lindenmayer system (L-system), introduced and developed by Aristid Lindenmayer 23 in 1968 to simulate a model for the growth progress of plants. Prusinkiewicz and Hanan, 24 based on the Lindenmayer system, have developed some fractals and a few tiling. Paul Bourke 25 introduced more recursive tiling and applications to generate them. Recently, Refalian et al 26 have followed the research of Paul Bourke, and have studied the application of rewriting systems to model IGPs.
In their proposed technique, specific rules control a step-by-step string rewriting system to build the pattern, using axioms and production rules. Each step works in tandem with the one before it. As a result, a complex pattern can be described using only a few written steps. In comparison to the use of other discussed methods, this methodology is highly close to machine language, making it faster and easier to code. Furthermore, in this method, a pattern can be modeled without consideration of their drawing methods or hidden sub-grids and only by having a sample of the pattern. Although in this method, some specific geometric information like analysis of the angles, proportions, and symmetries are required to define the grammar.
In the mentioned study, a confusion in modeling of IGPs with formal grammar is that, for an individual pattern, numerous syntactic grammars can be perceived. This means that various production scenarios can be designed for a single pattern, all of which are valid. 26 This complexity arises from the fact that these patterns are not limited to one basic shape, with fixed lengths and angles, like common examples of L-systems. A fivefold pattern consists of at least four shapes and various symmetries. Therefore, in the current research, our aim is to study the morphology of these patterns more profoundly from this perspective, in order to develop a highly responsive grammar for fivefold patterns. Furthermore, this research aims to investigate whether this methodology can generate a greater number of 5-fold patterns.
Introduction to formal grammar for IGPs
IGPs are a family of patterns that follow geometrical rules to arrange specific shapes for covering a surface with no gap. Implementing a “
In this research, the fivefold family patterns are studied. This family has a solid structure with a fixed set of shapes (e.g., in comparison with Moroccan patterns), which has been widely used in Iran, Turkey, Egypt, and central Asia (Figure 1). The fivefold system is immensely important to the history of Islamic art and architecture. More than any other systematic design methodologies, the fivefold system received significant innovation in pattern line variations, ever-greater design complexity, and repetitive geometry.
1
Examples of application of 5-fold system in architecture. Left: Isfahan, Bazaar Honar, Safavid period (18th century—Renovated in 1960). Middle: Isfahan, Hotel Abbasi, Restoration of a Safavid karavansaray—1965) Right: Qom, Seyedeh Masuma Shrine (14th century).
As extensively discussed in the previous sections, there are various strategies to study the IGPs morphology. The first strategy that has been observed more than the other ones is concentrating on the central star, the numbers of the folds and the possible arrangements of the pattern around it. Another strategy that has been widely used, mostly in order to prepare a parametric digital model, is a mathematical translation for the lines of the smallest motif and later extending it by a symmetry group.
However, when it comes to defining formal grammar via a string rewriting system, none of them is designed to respond correctly to such a representation. To understand the morphological barriers to constructing a string rewriting system for IGPs, first, we review the whole process and in the next section, we discuss the role of repetitive motifs within the pattern to define the grammar.
In a string rewriting system, each shape has an equivalent string and an alphabetical name. Each symbol in the string represents a line with a certain length, or an angle to define the direction of the next line. For example, a pentagon in the fivefold family can be presented as “P→y++y++y++y++y,” which in this study “y” is equal to a line with length of 1.618 units and “+” means a 36° clockwise rotation to start the next line (Figure 2). Later in (Figure 5), we will see where from the length of 1.618 and angle of 36 come. To understand the relation between strings and the graphics, one should imagine that these strings guide a pen through a path to draw the pattern (This logic in computer graphics is used in Turtle graphics, in which an imaginary turtle carries a pen to draw a shape following the instructions) (Figure 2). Shape definition for formal grammar. To define a shape with strings we can use turtle graphics systems for computer graphics as a medium. In this system, it is considered that a turtle carries a pen and while take orders to move step by steps, draw a line. The orders are can be “go ahead,” “turn left,” “turn right” etc. In this example, to draw a regular pentagon via turtle graphics, there are specific conventions. The length are defined as a unit length and represented by a character (here “y”). To turn counterclockwise character “+” and clockwise “-” are used. Moreover, we need a unit angle. Here in this example, the unit angle is 36°. As a result, for turtle to draw a pentagon, it should move as y++y++y++y++y.
In IGPs, we have a tessellation of a set of shapes, which we can interpret their distribution in various ways. One approach is a collection of shapes, which sit together edge by edge (Figure 3-1). Another approach is to consider them as a collection of shapes, which are connected from their vertices and form some empty spaces between them (Figure 3-3 and 3-4). Here one shape can be connected to various shapes through all its vertices. In the second state, an interesting characteristic will appear; we can start from one point on one shape and draw all its connected shapes with one continuous polyline (Figure 3-5). This aspect is used in Refalian et al.,
26
case studies to develop a grammar to construct a toolpath for CNC machining. Here we will call it branch-making action and it is the most important step in defining a morphological grammar for IGPs. Various approaches to read the structure of an IGP. Part 1 shows the pattern as lines. Part 2 shows the pattern as a tile with cropped edges. Part 3 shows the pattern with positive highlighted shapes (with central star as protagonist). Part 4 shows the version of the pattern with highlighting the negative shape (or a reverse state of the positive shape). Part 5 shows the possibilities of drawing the pattern with a single polyline.
Considering the mentioned feature, defining a morphological grammar for IGPs means discovering the connections between shapes in a manner that they can be described as axioms and rewriting rules. For example, in (Figure 4), the central star of patterns and the surrounding pentagon can be written as: S→ “x++x-x++x-x++x-x++x-x++x-x++x-x++x-x++x-x++x-x++x” P→ “y++y++y++y++y” (“x”= 1 unit, “y”= 1.618 unit, “+” =18° clockwise, “-“=18° counter clockwise) Step-by-step construction of a motif, highlighting the connecting points of its shapes. Part 1 shows the central star. Part 2 presents a point-to-point connection between the central star and the neighboring pentagon. In Part 3 we can see the complete round of the connection of central star and surrounding pentagons. The same action continues in Part 4 and 5 and illustrate that a pint to point connection between only positive or only negative aspect of a pattern is possible.

To draw the pattern in (Figure 5-5), the drawing path is similar to what we can see in (Figure 3-5). It means that while we are drawing Examples of Kond, Tond, and Shol IGP. At the middle part of each pattern, their set of shapes can be observed. Each shape follows a modular angle between the edges and certain length measures.
To proceed with the pattern in Figure 4, this time we should take the strings for the pentagon and insert the new shape’s sentence inside it. If the new shape is: T→ “y++x-x++y++y++x-x++y”
Then we need to insert it through the pentagon as follows: “y++yTy++y++y.”
To write the complete grammar, an axiom of “A+A+A+A+A” can be considered, in which the five “A’s” respond to the 5-fold symmetry. Each “A” will is replaced by “BB,” to achieve to the ten branches of the star; then inside “B” there is a parameter called “P” and inside “P” there is another parameter called “T.” Axiom = A+A+A+A+A A→BB B→-xPx-xPx-xPx-xPx-xPx P→y++yTy++y++y T→y++x-x++y++y++x-x++y
However, IGPs are not as straightforward as the discussed example. They have various symmetry axis, which makes it more complicated to define a connection path. Due to this, the main challenge of defining a rewriting system for IGPs is to define the sequence of its shape. In the next section, we will introduce a general structure of the fivefold system and its classes. We will use their symmetric system to define repetitive branches of connected shapes, and at the end, we will use them to write the rewriting grammar for these patterns.
A formal syntax for fivefold star patterns
Morphological study of research cases. First column shows the pattern in positive mode. Second column shows a classic symmetry study. Column 3 presents the applied shape branching. The last column shows a diagram of branches and their symmetry type.
We briefly mentioned before that any formal grammar begins with determining the set of alphabets of the language. The alphabets of an IGP are the shapes that construct the pattern. As a result, the first step of writing grammar for IGPs is preparing the definitions of its shapes.
Shape definition
As we can see in Figure 5, fivefold IGP consists of particular shapes, which follow specific geometrical rules. One of the key shapes in both sub-categories of IGPs is the central star. In fact, the difference between each category goes back to this central star. The star is constructed based on the division of a circle and connecting these divisions and extending them (Figure 6). The rest of the shapes are geometric cuts of this main star and follow its proportions.
27
The fivefold main stars and their formation.
The convention of the characters and their meaning in the developed code. Authors tried to stay loyal to the similar conventions like in turtle graphics.
List of the shapes is the patterns of research cases and their string equivalent.
Branch-making
Branch making is the essential part of the formal grammar definition for IGPs in this research and it is supposed that a morphological analysis IGPs can provide with us the information and direction to accomplish their grammar. To analyze each pattern, the smallest crop of the pattern is examined, which can be arrayed by a translation in x and y directions. The star shape is located at the center of the frame to provide maximum symmetry. Each apex of the star is considered as a start point for a branch of connected shapes. As this, each pattern can have ten branches.
Considering the symmetrical nature of these patterns, it is possible to organize these branches in a way to be repetitive by a rotation or reflection translation. In the case of our selected crop of patterns, two symmetries can be observed in all the cases. A horizontal and a vertical reflection axis, which passes through the center of the pattern divides it into four congruent sections. It means that we can expect some branches to repeat themselves, rotating around the center point of the star pattern.
Defining the proper branches is the first step to construct grammar. The branching process starts from the central star shape. If we consider the star shape as the first round of shapes, the second round consists of 10 shapes, which are connected to the outer vertices of the star. Each one of these shapes is the start point of a branch. Each individual branch can be symmetrical or not. It was observed that a symmetric branch can be repeated in all four section of the pattern with no change, while an asymmetrical branch only was duplicated in two sections, once in upper half and once in lower half (Figure 7). Branch alternatives of case studies. Eight types of branch repetition were investigated in the 12 studied patterns.
Table 1 shows the analysis of our case studies. In column 1, the sample pattern is presented. Column 2 shows the symmetry diagram based on group theory. Column 3 demonstrates the branches that connect the shapes of the pattern. Column 4 summarizes the symmetrical analysis in one diagram. As it can be observed, the symmetric branches can be repeated by a rotation translation. While an asymmetric branch can have two different modes: a reflection mode, or a rotation mode. This is an essential aspect in order to write grammar.
For example, in sample #7, branches 2, 4, 7, and 9 are symmetric and are duplicated. Branches 3 and 8 are symmetrical and equal. Branches 1, 5, 6, and 10 are congruent but a rotation translation of branch 1 does not match with branch 5. Although it seems a minor change, however, in writing grammar, it makes a major difference in the order of the connected vertices.
Turning back to sample #7, if we formulate the action of the branch making as T: the constructed branch; S1: First shape in the branch; S2: Second shape in the branch; … Si: Next shape in the branch; VI: The number of the vertex of the shape, which is connected to another shape;
Then the branch 1 will be
It is important to pay attention that there is no direct match between the symmetrical structure from the group theory and the IGP’s formal grammar. They necessarily do not interact together, or one leading to another. In the other words, it is not possible to reach symmetry groups in the formal grammar branches. However, as general knowledge, it shows that there are vertical, horizontal, or diametrical symmetries. Figure 7 shows that eight types of branch repetition have been discovered in the 12 studied patterns. Besides that, almost every pattern has its own schema of branches and no two patterns share the same branching path. The only exception is sample #1 and sample #3, which have the same branch diagram but the characteristics of their branch is different.
Re-writing formula
The method to define the formal grammar for each pattern is very similar to the process that was explained in Figure 4. Branch-making step already gives us enough data to start the rewriting formula. Figure 8 shows the formal grammar for pattern sample #1 from Table 1. Considering the morphological analysis that we mentioned before, the initial state of the pattern is the star shape. The axiom in the grammar is called Girih Kond 2 o 5 grammar.

However, to continue the branch of the shapes, we need to add markers that later be replaced by other rules.
The marker for each branch is determined with a capital letter
The rules continue until there is no marker. Branch E and branch F does not include any marker and it means that here the grammar finishes. The final string, which draws the complete pattern, is
Figures 9 and 10 present two more examples of grammars of Girih Tond 2 o 5 grammar. Girih Shol (Tond o kond Moorianeh) grammar. The list of the patterns of research cases and their string equivalent which are produced via the introduced methodology in this paper. Here, x = 1, y = 1.618, z = 2.236 and ‘-‘ = 36° CCW and ‘+’= 36°C. Capital letters means that turtle should move without drawing and character ‘|’ means a 180° rotation.

Cad application and tool development
Dealing manually with long lines of strings and their rewriting is not reasonable, although it was necessary to experience it in order to comprehend the process. By using a CAD toolkit to implement this methodology, users can easily apply rules and constraints to generate complex and intricate patterns. In addition, such a toolkit can provide a user-friendly interface that allows users to interact with the formal grammar methodology. This can include tools to manipulate and adjust the parameters of the rules and constraints, as well as visual feedback to show how changes to these parameters affect the resulting pattern. Moreover, a CAD toolkit can facilitate the design process by automating repetitive tasks and allowing for easy iteration and exploration of different design options. This can lead to more efficient and effective design workflows, as well as the ability to generate a larger number of variations on a given pattern.
Developing a CAD toolkit to serve the mentioned purpose requires two separate bodies. First body, or String Body(StB), is designed to produce the string equivalent for a given pattern. By this body, it is possible to make a library of patterns and easily share it by passing the string formula. The second body, or Shape Body(ShB), works to convert a string to its equivalent shape or pattern.
In the previous section, we explained that developing formal grammar for an IGP requires translating its geometries to strings and composing a generating system to conduct sentence making, from an axiom to the result. Thereby, the structure of such a pattern is based on 1. Shape definition → A set of shapes defined as strings with access to marking particular vertices 2. Generating rules → Branch making via connecting particular vertices of distinct shapes
A
The final section, which is needed to complete the toolkit, is a component that a general user can utilize to generate a pattern from its string. In the other words, we need an interpreter to convert the achieved final string to the corresponding geometry, which in this case is a polyline or a set of lines. As a result, string conversion to polyline is added to the process as the third section (Figure 11, left and middle column). 3. String conversion → Act of translating the strings to their equivalent geometry Diagram of passing from Formal grammar to CAD tool.

The designed IGP toolkit should respond to all three sections of the production algorithm for IGPs to provide a convenient toolkit (Figure 11- right column).
String body
The String Body is designed to cover tools for shape definition (called Shape Component tools) and for generating rules (called Shape Controller tools).
Shape Component tools consist of strings of all shapes of the fivefold system. They can be used as a library of shapes to make various arrangements inside the 5-fold class. To add any other shape that is not already in the library, they can be added by manually writing their string equivalent.
Each shape component in the library has some shape controller integrated. It gives access to the parameters of the shape, like directions and rotations, as well as access to the vertices of the shape to connect it to another shape (Figure 12). Besides that, for shapes that are generated manually, a separate component is available to give access to the parameters of that shape. Figure 15, components 1 to 4 shows these tools. The connection of shapes in the toolkit for sample #1. Each shape component gives access to the vertices of the shape and let the user to connect the next shape.
Shape body
The other section of the toolkit is converting string-patterns to geometry that in this case is a polyline. To translate the strings to geometry, an interpretation of Turtle graphics is utilized. Figure 2 showed how at the beginning, a translation of the geometry to strings was defined. The same operation in reverse is required to convert the strings to geometry. The output of the developed code in this section is a list of individual lines with Cartesian coordinates.
Although a list of lines provides the required result, however, by processing the achieved data (lines), and extracting the start and endpoints of the lines, it is possible to define only one polyline that passes from all the stop points. This single polyline later can be used as a toolpath for further productions like in CNC machines.
Alternatively, using the group of lines supports the slicing operation on the shape’ edges. In the other words, it is defined in the code that anytime the turtle arrives at capital terminal strings (X, Y, Z, U, V, W) (F in Table 2), it should walk the path without drawing any line. This feature, for example, helps to model patterns that fit inside a rectangular frame, which here we call it, Tile Mode (Figure 3-1 and Figure 3-2). In conclusion, the output of the string converter component provides two modes: 1. ToolPath Mode (Point to polyline) 2. Tile Mode (group of lines)
Figure 13 shows converting the strings to geometry. The whole algorithm is demonstrated in Figure 14. This algorithm now works as a Grasshopper add-on in Rhinoceros (Figure 15). Converting the final string to geometry, which in this case is a polyline or tool path. Algorithm of the developed toolkit. Examples of components for the IGP toolkit. Component number 1, 2, and 4, shows some shapes in the collection of the shapes in the IGP Kond class. Each shape component contains the string equivalent of the shape, and as an input, there are two Boolean operators to change the direction of the strings to counterclockwise or rotate it 180°. In addition, it is possible to change the start node of the shape. This is useful when the shape does not have rotational symmetry and it is important to choose the start point. The next important controller is “CutDomain” which is for the shapes at the border, which are cut by the frame and it is required to replace the lowercase letters with uppercase. Component 3 gives access to all the vertices of a star shape (Shamseh). It is designed separately due to the higher number of vertices in a fivefold star. Component 5 is the string to the geometry converter. It accepts up to five lengths, an angle, and the axiom and the rules (which are the output of the connected shapes). Moreover, the start point of the pattern in the canvas (viewport) is defined by a point. In addition, there is a Mode selection to choose between Toolpath and Tile mode.


The application of this methodology is not limited to constructing old patterns. It is also possible to explore the design space of IGPs. Figure 16 shows some results of an attempt to seek new patterns. Moreover, by changing the assigned values in the production process, it is possible to produce new motifs and patterns (Figure 17). Design space exploration. Defining new grammars with available shapes of 5-fold family. Design space exploration. Changing shape parameters of the motif #1 can produce new variations (2 to 8).

Conclusion
In this paper, we conducted a morphological study of fivefold Islamic geometric patterns (IGPs) using formal grammar for CAD applications, with a specific focus on the introducing these patterns to computational tools. While prior studies by other scholars have primarily explored the original methods of generating traditional IGPs and developing new patterns based on the old ones, our research sought to contribute to the preservation of this culturally significant heritage and open up new possibilities for pattern generation within a standardized methodology.
The digital generation of IGPs poses several challenges, including the lack of standardized documentation, intricate nature of the patterns, and the need to consider their cultural and historical context. Our approach addressed these challenges by shifting the emphasis from geometrical drawing to morphological structure through the use of formal grammar. By doing so, we established a generating system based on machine language with a set of rules and constraints, simplifying the design process and enabling easier collaboration and reproduction of these patterns.
One of the major obstacles in studying IGPs has been the lack of comprehensive documentation, owing to their traditional transmission from master craftsmen to apprentices orally and visually. Additionally, the diverse cultural contexts in which these patterns were produced and the evolution of their use over time has led to variations and adaptations that have not always been recorded. Our morphological study provides a fundamental road map and essential data to initiate the formal grammar method for IGPs, enabling a systematic and consistent approach to their digitalization.
The development of the morphological method presented in this research offers a more generalized approach compared to prior studies on implementing formal grammar in modeling IGPs. By encompassing all patterns of the studied class, users are freed from working with strings of lines and can utilize a visual interface for greater ease of use. Moreover, the system generates a single polyline that can be used for digital fabrication tool paths, enhancing convenience and efficiency.
We studied 12 known Persian patterns from the fivefold family and found that each pattern possesses a unique shape structure that fits within a similar rewriting system. However, for more complex patterns with long strands, recognizing an optimized path between the shapes can be challenging. Addressing this issue will require further research and the development of an automatic shape branching process.
In conclusion, this research contributes to the ongoing efforts to understand and utilize Islamic geometric patterns in the digital realm. By focusing on the formal grammar approach and morphological study, we have provided valuable insights and methodologies for the preservation and generation of IGPs using computational tools. This work not only enhances our understanding of these intricate patterns but also opens up new avenues for creative exploration and application within the field of CAD and beyond. As digital technology continues to evolve, the study of Islamic geometric patterns through formal grammar will remain an essential and relevant area of research, further enriching our appreciation of this culturally significant heritage.
For the further steps of this research, it is envisioned to expand the library of patterns, studying and analyzing other families of IGPs and establishing a BIM tool. In addition, applying optimization algorithms and machine learning to find the strands automatically is another topic to study. Another contribution of this methodology is to develop a procedural pattern-generating tool based on the introduced rewriting system. Furthermore, the designed IGP toolkit demonstrates characteristics of a pedagogical tool for learning IGPs, their logic and their potential for designing new patterns within the same family which can be examined via educational workshops.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
