Repositório ISCTE-IUL

— This paper describes the visual interface of a configurable and extensible system to support generic work with shape grammars. Shape grammars allow the implementation of computational mechanisms to analyze and synthesize designs of visual languages and have been used to represent the knowledge behind the creative work of architects, designers and artists. This kind of grammars is inherently visual. The system described, a kind of universal machine for shape grammars, allows users to build their own shape grammars and experiment with them. It has been the focus of our past work, it mixes technological and artistic aspects and it has a specific computational architecture which includes a symbolic and a visual interface. The latter one is the subject of this paper.


s to build their own shape grammars
and experiment with them.It has been the focus of our past work, it mixes technological and artistic aspects and it has a specific computational architecture which includes a symbolic and a visual interface.The latter one is the subject of this paper.

Shape grammars were introduced by George Stiny and James Gips in the 1970s [1] and have been a topic of research since then.The focus this research is, in a few words, in representing and applying knowledge about languages of design basically through the use of concepts from formal grammars and rule-based/production systems [2] [3], essentially to give support to creative activities of designers, architects and artists.

Basically, a shape grammar is composed of (1) a set of basic shapes (the shape alphabet), (2) a set of rules, and (3) a special shape, the initial shape, used to trigger rule application.

The mechanics of rule application a d shape generation is as follows.In a rule, A→B, the left side, or antecedent, A, and the right side, or consequent, B, are shapes.A rule, when applied, substitutes the shape of the right ide of the rule for the shape of the left side.Applicable rules may recursively be applied to a shape, until there are no more applicable rules or some termination condition holds.A shape computation, or shape derivation, is a sequence of shapes in which each shape, except for the initial shape, is generated from the previous by the application of a rule of the shape grammar.A rule A→B is applicable to a shape, or design, or composition, C, if there is a similarity geometric transformation T which, when applied to shape A makes A a part of C, i.e., a transformation T such that T(A) ≤ C, where ≤ denotes the sub-shape relation.Application of the rule results in a new design, C', that is computed subtracting from C the result of applying the transformation T to A, and then adding to C the result of applying T to B, i.e., the resultant design will be C' = (C -T(A)) + T(B), where + and -denote the shape sum and shape difference (or subtraction) operations.Details of the + and -operations, as well as the ≤ relation, which are part of the so-called algebras of design [4], are outside of the scope of this paper, but an introduction and simple examples can be found in [5] (in section 2).It remains to say that, using operations on shapes from a special kind of algebras called algebras of maximal shapes, the computational mechanism used to match the left side of a rule with parts of the composition can be made to detect and accommodate embedded emergent shapes, i.e., shapes that were not explicitly included there, and this feature is, from an artistic perspective, very much appreciated.This all seems like Artificial Intelligence knowledge representation rules applied to visual (i.e., with shapes) grammars to support some kind of creativity.In fact, shape grammars are related to design languages as phrase grammars [6] are related to symbolic/textual languages.Both can be considered production systems, where replacement rules can recursively, and incrementally, generate phrases of a language.But note that although shape grammars may exhibit (shape) emergence, a feature that production systems typically don't have.


II. A SUMMARY OF SHAPE GRAMMAR RESEARCH

In very brief words, the research area of shape grammars has been focused in conceptual and theoretical aspects, as in [7] [4] [8], in analysis, i.e., the development of specific shape grammars

languages of design extracted from corp
ses of designs in architecture, product design or painting, as in [9] [10] [11], and in synthesis, i.e., building specific shape grammars to define original languages of designs, as in [12] [13] [14].Other research threads include the development of algorithms for shape manipulation and rule matching and application processes, as in [15] [16] [17], and appropriate interfaces and generic and reusable shape grammar interpreters, as in [18] [19] [20], including didactical purposes.

More recent research consists mainly on refinements on previous approaches as well as a diversification of the application, see [21] [22] [23], for instance, and see also the review in [24].


III. PREVIOUS WORK RELATED TO GSG

Our explo atory work preceding the GSG system can be seen in [25] [26] [27], but the central ideas were described in [28] [29] [5].As is referred in [28] [29], to support the creative activity of diffe

nt kinds of users (students, desig
ers, architects, artists) in interacting with the generic reusable shape grammar interpreter, which is the underlying core of the system, the interface, in particular the visual interface, is an important component of the GSG computational architecture, shown in Figure 1.Here we can see that the visual interface is a part of the interface layer of the system, together with the symbolic/API (programmatic) interface.A third kind of interface, the textual/file interface, not shown, is also available.A notable point in GSG is that all shape grammar objects, i.e., shapes, rules, and grammars, that come to existence in the system environment may have an independent representation in three formats: the symbolic (through programmatic objects), the visual (through graphical windows) and the textual (with an appropriate text/file external representation) format.

In subsequent work about the usability of interfaces of shape grammar computational systems, see [30] [31], we have devised a set of requirements that can be used either to evaluate interfaces of existing shape grammar systems, or as a set o good rules to follow in the implementation of new ones.The requirements can be slightly different as users are either students/beginners in the field of shape grammars, or architect, designer or artist specialists, or have further additional expertise in programming, but, for simplicity, let us think we assume the student/beginner perspective and have didactical purposes.The requirements include the following minimal set of features, or abilities, of the visual interface:

1. Creation of grammar shapes; 2. Creation of grammar rules; 3. Grammar rule application; 4. Manipulation (e.g., edition) of obtained shapes; 5. Alterations (e.g., edition) to grammar shapes and rules.

All these tasks can be performed through either the symbolic/API, or the visual interface.In the following three sections we show how they can be performed using the visual GSG interface.


IV. BUILDING AND EDITING SHAPES

Building and editing shapes through the visual interface of GSG is done using the shape editor/viewer.This program component can be invoked either through the main GSG grammar system, or it can function indepen

ntly.Each individual shape can b
built and manipulated using an individual shape editor/viewer document window.As an example, this is shown in Figure 2, where a shape containing two basic shapes, a rectangle and a line, viewed in the graphical area of the window, is being shown for edition.

At the bottom center of the shape document window a list panel lists the basic shapes present in the shape, a rectangle and a line, in the case, in textual format (the same format of the textual/file interface).At the bottom left, text slots may s ow data related to a basic shape when one is selected.These can also be used to create new basic shapes textually, as these slots are, in fact, text input panes.Selection of basic shapes can be made either graphically, by pointing with the mouse pointer on the shape graphical area, or by pointing on the element of the list panel associated with the basic shape.

As seen in Figure 2 and, in detail, in Figure 3 a), the top right side of the shape document window has a series of display and control elements that allow the creation of new basic shapes, with options for the associated properties, like "color", "f ll", "dash", "thickness", as well as changing, transforming, and deleting existing ones.Different two-dimensional basic shapes can be created, as shown in Figure 3 b), where the "draw/select" option pane is open.Besides points, lines (straight line segments), rectangles, circles and other plane figures, the choices include the possibility of user defined and pre-built/loaded from an image file basic shapes (the "basic-shape" and "include-shape" options, respectively).At the present stage of GSG, for the purpose of accommodating shape emergency ability, the most important basic shapes are limited to lines and points.

Options for controlling certain features of the graphical area, as "snap" and visibility of "axis" grids and "labels", "direction lines" and "intersection points", are also available, as seen on Figure 3 a).Actions like geometric transformation (transla ion, rotation, uniform scaling and sequences of these) can be defined for the shape and applied to a selected basic shape, see the action option pane in Figure 3 c).At the top, checkboxes for the options to make the shape "read-only" (immutable) and to use the "maximal" algebra operations are also available.

In the menu bar, the "File" menu option, as seen in Figure 4 a), has different options for opening and saving shapes from/to files, including loading other shapes into the present shape, as well as loading and saving certain shape related definitions, lik user defined shapes and geometric transformations.The "Edit" option, see Figure 4 b), displays editing options for any selected basic shape, some of which are duplicated in the context menu that can be made to appear on a selected basic shape, as depicted in Figure 4 c).

At the top of the shape editor/viewer window, a text slot may display a record of the "ancestors" of the shape, i.e., the shapes from which the present shape has been derived (if there are any), and others show the x and y coordinate values of the extremes and center of the shape at its the present state.


V. BUILDING AND EDITING RULES

Building and editing rules is done using the rule editor/viewer, a program component that can be invoked either through the main GSG grammar system, or can function independently.Each individual rule can be built and manipul

ed using an individual rule ed
tor/viewer document window.A rule has the left, or pre-condition, side and the right, or consequent, side, and both are shapes and are displayed in the respective graphical window area.See Figure 5, where an example rule is being shown for edition, with a rectangle in the left side and, in the right side, an equal rectangle and a circle in a certain position related to it.This rule will have one possible application instance to each and any rectangle in the composition that can be found similar to the one in its left side.Similar means that it can be made equal, or, as we say, can match, when transformed through a geometric similarity transform (i.e., a combination of translation and/or rotation and/or uniform scaling).And if this rule, being applicable, is applied, the application results in the circle, transformed with the same transform combination used to match the left side, being added to the composition.Most of the window display and control elements for each side of a rule in the rule editor/viewer window are similar to the ones in the shape editor/viewer window.The menu and the controls in the central area are shared by each side of the rule, and certain options and actions associated to them will apply either to the left, or to the right side depending on the selection of one of the two radio buttons, labelled "left" and "right".

Finally, in the central area, there is a set of checkboxes to allow for the control of the matching process.They control if scaling, rotation and translation (horizontal and vertical mirroring checkboxes are present but not used at this stage) are allowed in the m tching process, and also if matching takes into account equality of the values of "fill", "dash", "thickness" and "color" properties between the shape of the left side and the composition.


VI. BUILDING, EDITING AND EXECUTING GRAMMARS

Building and manipulating grammars, controlling the execution of instances of shape and rule editor/viewer as well as executing grammars through rule application to shapes is done using the main GSG grammar system, see

igure 6.In Figure 6, the first three list pan
ls on the left list all the shape, rule and grammar file names in the working directory.A grammar was opened, the one with the name selected in the grammar list panel, and its shapes and rules were automatically loaded and are listed in the fourth and fifth list panel.This was made with the "Open selected grammar" option of the "File" menu, in which different options for creating and saving grammars are also available, see Figure 7 a).Also, as seen in Figure 7 b) and c), both the "Shape" and the "Rule" menu include options to create new shapes and rules, which invoke the shape and the rule editor/viewer, respectively, to include and exclude shapes and rules in/from the present grammar, and also, in th case of the "Shape" menu only, some operations on whole shapes.The last, and very important, is the "Grammar" menu.This has an option to find which rules of the present grammar are, at any moment, applicable to a selected shape, taken as the initial shape, an option to apply to a selected shape a selected (applicable) rule, and an option to automatically apply rules in a depth first strategy and viewing the resulting shapes (other different strategies are being developed).

For reasons of space we will only show an example of the second option mentioned above.In Figure 8 we are about to apply a selected rule, the same in Figure 5, to a selected shape, the same in Figure 2, generating a copy of the original shape.The application modes, or inst nces, of the rule to the shape are just two, in this example, i.e., the rule has two possible matching instances, with 0 and 180 rotation degrees and the appropriate translation and scaling transforms.This is shown in Figure 9, both textually, in the list panel at the bottom part of the main GSG grammar system window, and graphically, in the original shape (which will be automatically open) by the two phantom circle shapes at the right and left of the rectangle.If we take the first choice mentioned (the one associated to the 0 rotation degrees), by double clicking on the corresponding option in the list panel, we have, as a result, the new automatically generated shape in Figure 10, shown in a newly automatically opened shape editor/viewer window.


VII.

CONCLUSIONS AND FUTURE WORK n this paper we described the visual interface of GSG, a generic shape grammar system that allows users to build their own shape grammars, experiment with them, and test and refine them.The options taken in the implementation of in the interface of this program were guided by a set of requir

ents,
found necessary, for this kind of systems, in past work we made.The GSG visual interface was built using the CAPI graphics component of the LispWorks ® IDE system.

In the future, we plan to refine and expand the system, including working on components at its core, in particular related to the implementation of maximal algebras and ability to recognize shape emergence.But this is, in fact an already work in process.

Figure 1 .
1
Figure 1.The GSG computational architecture.


Figure 2 .
2
F gure 2. A shape in the GSG shape editor/viewer.




a) File menu, b) Edit menu, c) Context menu.


Figure 5 .
5
Figure 5.A rule in the GSG rule editor/viewer.


Figure 6 .
6
Figure 6.The main GSG grammar system window.


Figure 9 .
9
Figure 9. Application