Anda di halaman 1dari 11

Delft University of Technology

An Algebraic Approach to Implementing a Shape Grammar Interpreter

Stouffs, Rudi

Publication date
2016
Document Version
Final published version
Published in
Proceedings of the 34th eCAADe Conference

Citation (APA)
Stouffs, R. (2016). An Algebraic Approach to Implementing a Shape Grammar Interpreter. In A. Herneoja, T.
Österlund, & P. Markkanen (Eds.), Proceedings of the 34th eCAADe Conference: Complexity & Simplicity
(Vol. 2, pp. 329-338). eCAADe.

Important note
To cite this publication, please use the final published version (if applicable).
Please check the document version above.

Copyright
Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent
of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.
Takedown policy
Please contact us and provide details if you believe this document breaches copyrights.
We will remove access to the work immediately and investigate your claim.

This work is downloaded from Delft University of Technology.


For technical reasons the number of authors shown on this cover page is limited to a maximum of 10.
An Algebraic Approach to Implementing a Shape Grammar
Interpreter
Rudi Stouffs1
1
National University of Singapore; Delft University of Technology
1
stouffs@nus.edu.sg

Shape grammars come in a variety of forms. Algebras of shapes have been


defined for spatial elements of different kinds, as well as for shapes augmented
with varying attributes, allowing for grammar forms to be expressed in terms of a
direct product of basic algebras. This algebraic approach is extended here to the
algebraic derivation of combinations of basic shape algebras with attribute
algebras. This algebraic abstraction at the same time serves as a procedural
abstraction, giving insights into the modular implementation of a general shape
grammar interpreter for different grammar forms.

Keywords: shape grammars, shape algebras, parallel grammars, compound


shapes, implementation

INTRODUCTION Grammar formalisms for design come in a large va-


A shape grammar is a formal rewriting system for pro- riety, requiring different representations of the en-
ducing languages of shapes (Stiny and Gips 1972; tities being generated, and different interpretative
Stiny 1980). A shape grammar is typically specified mechanisms for this generation. Shape grammars
to consist of a set of productions, or shape rules, op- also come in a variety of forms, even if less broadly.
erating over a vocabulary of (terminal) spatial ele- Most examples of shape grammars rely on labeled
ments and a vocabulary of (non-terminal) symbols or shapes, a combination of line segments and labeled
markers, e.g., labels, and to include an initial shape as points (in two dimensions) (Stiny 1980). Stiny (1992)
the starting point in the productive (generative) pro- proposes numeric weights as attributes to denote
cess (Stiny 1980; Yue and Krishnamurti 2013). Then, line thicknesses or surface tones. Knight (1989; 1993)
a shape is defined as any composition of spatial ele- considers a variety of qualitative aspects of design,
ments and, optionally, symbols from the respective such as color, as shape attributes. Stiny (1981) also
vocabularies. A shape rule is commonly expressed proposes to augment a shape grammar with a de-
in the form a → b, with both a and b constituting scription function in order to enable the construction
shapes, such that the application of the rule to a of (intended) descriptions of designs.
shape s under a (similarity) transformation t yields the Implementing a shape grammar interpreter requires
shape s − t(a) + t(b), with the condition that t(a) ≤ s. implementing the part relationship for shapes—with
The language defined by a shape grammar is the set or without attributes—, the operations of sum and
of shapes generated by the grammar that do not con- difference on shapes, and solving the matching prob-
tain any (non-terminal) symbols. lem, that is, identifying under which transformation a

SHAPE, FORM AND GEOMETRY | Grammars and Concepts - Volume 2 - eCAADe 34 | 329
rule may apply to a given shape. Beirão (2012, 228- to be made dependent on the total number of rooms,
236) offers a survey of (implementations of ) shape which is only known at the end of the production pro-
grammar interpreters so far, and must conclude that cess. Instead, Li (1999) suggests adopting (at least)
they have common limitations. Many of them com- two descriptions, the first one a diagram with the
pute only on two-dimensional shapes; and most do number of rooms as independent parameter(s), and
not apply subshape detection and therefore do not the second one the plan with the room sizes as de-
support emergence. Also, "very few shape grammar pendent parameters (of the number of rooms). By
interpreters allow for the implementation of rules op- staging the production of the diagram before the
erating with symbols" (Beirão 2012, 235), never mind production of the plan, the assignment of values to
other attributes, or a description function. the dependent parameters can be postponed until
In this paper, we will address the problem of after the assignment of values to the independent
developing an implementation of a shape grammar parameters.
interpreter supporting varying shape grammar for- Duarte (2001) defines a parallel grammar as sep-
malisms, by focusing on the implementation of par- arating different representations or aspects of a de-
allel and compound shape grammars. We will re- sign into different computations that interact with
view the literature on parallel and compound shape each other. Specifically, Duarte (2001; 2005) con-
grammars and propose an algebraic treatment facili- siders a discursive (parallel) grammar incorporat-
tating a modular approach, based on a similarity be- ing a shape grammar and a (textual) description
tween algebraic abstraction and procedural abstrac- grammar−as well as a set of heuristics, where the lat-
tion (Frank 1999). ter is intended to constrain the rules that are appli-
cable at each step of the design generation. While
PARALLEL AND COMPOUND SHAPE the shape grammar operates on shapes and the de-
scription grammar on textual (including numeric) de-
GRAMMARS
scriptions, their rules are commonly coupled, with
Originally, a parallel shape grammar was defined by
the description rule part constraining the shape rule
Stiny (1975, 37) and Gips (1975, 7) as a shape gram-
part. This combination of a shape grammar and a
mar intended to be used in the parallel generation
description grammar follows Stiny's (1981) definition
of shapes, that is, "whenever a shape rule is used, it
of a description function to augment a shape gram-
is applied simultaneously to every part of the shape
mar in order to construct design descriptions. Where
to which it is applicable" (Gips 1975, 7; Stiny 1975,
Stiny (1981) considers a description function as made
37). This is in contrast to the more common serial
up of functions, with each function assigned to a
application of shape rules, where at each step of the
shape rule and computing in parallel to the shape
generation a shape rule is applied to only one part of
rule, Duarte instead denotes the functions as descrip-
a shape. However, more recently, the term parallel
tion rules and the description function as a descrip-
(shape) grammar has been adopted in the context of
tion grammar. Otherwise, these operate in exactly
parallel computations on multiple descriptions.
the same way and with the same intention. In fact, al-
Li (1999) defines a parallel grammar as a gram-
though Stiny nowhere adopts the term parallel gram-
mar operating on different descriptions with the ob-
mar in this sense, Knight (1999; 2003a) explicitly at-
jective to resolve parametric dependencies. For ex-
tributes the concept to Stiny (1981). Knight (2003a)
ample, consider a shape grammar generating a plan
also offers a definition of a parallel grammar as "a net-
where the number of rooms is depended on the se-
work of two or more grammars that operate simulta-
lection of rules applied. In this process, it is almost
neously."
impossible to constrain the boundaries of the plan at
Admittedly, Li (1999) and Knight's (2003a; also,
the same time, as this would require the room sizes

330 | eCAADe 34 - SHAPE, FORM AND GEOMETRY | Grammars and Concepts - Volume 2
Duarte 2001) interpretation are not unequivocal. of grammars that do not operate in parallel. For ex-
Following Stiny's (1990) definition of a design as ample, Beirão (2012) uses the term compound gram-
"an element in an n-ary relation among drawings, mar to denote a composition of several discursive
other kinds of descriptions, and correlative devices grammars, where each discursive grammar formal-
as needed," Li (2001; 2004) considers seven drawings izes a so-called Urban Induction Pattern (UIP), en-
(from plan diagram to plan, section and elevation) coding a typical urban design operation or design
and nine descriptions (specifying measures of width, move. Knight (2004), instead, suggests a distinction
depth, and height, among others), in his specifica- between synchronized and a-synchronized parallel
tion of a shape grammar for (teaching) the architec- grammars, where the latter allows for sequential pro-
tural style of the Yingzao fashi. However, he consid- duction stages as proposed by Li (1999; 2001).
ers only four grammar components to define his par-
allel grammar, corresponding to four stages in the SHAPE ALGEBRAS
production (Li 1999). However, in Knight's (2003a) While Stiny avoids the term parallel grammar when
parallel grammar interpretation of Stiny's (1981) ex- referring to parallel computations, he does empha-
ample, the two grammar components of the parallel size parallel computations in multiple algebras. For
grammar−the shape grammar and the description example, when a rule applies to a shape composed
function−apply hand in hand: "the rules of a paral- of points and line segments, though the rule may
lel grammar may be linked so that the application require both one or more points and one or more
of a rule in one grammar triggers the application of line segments to be present within a prescribed spa-
one or more rules in other grammars" (Knight 2003a). tial relationship, the rule computes with points and
In fact, Knight (2003a) suggests the same interpreta- line segments in parallel. The overall shape rule com-
tion for Li's (2001; 2004) grammar, with each drawing putation actually combines two computations−one
and description specifying a component grammar in with shapes of line segments and one with shapes of
the parallel grammar, for each stage. Duarte (2001) points−"that are carried out in parallel and influence
takes a similar position when describing his discur- one another mutually" (Stiny 1990).
sive grammar applied to the houses designed by the Points and line segments, and by extension other
architect Alvaro Siza at Malagueira. Even though, spatial elements, can be considered to adhere to an
strictly speaking, he only refers to two grammars−a algebra (specifically, a generalized Boolean algebra
shape grammar and a description grammar−, he (Krstic 1999)), that is ordered by a part relation ('≤')
specifically acknowledges that both grammars in- and closed under the operations of sum ('+'), prod-
clude several sub-grammars. "These sub-grammars uct ('·'), and difference ('−'), as well as relevant trans-
correspond to viewpoints in the shape grammar (e.g. formations. For example, points may belong to the
first floor plan), and to features in the description algebra U02 and line segments to the algebra U12
grammar (e.g. morphology)" (Duarte 2001). View- (in two dimensions) (Stiny 1992); Uij denotes the al-
points define separate drawings (sketches, plans, el- gebra of spatial elements of dimension i, e.g., 0 for
evation, envelope, etc.) and features individual de- points, 1 for line segments, 2 for plane segments, em-
scriptions. bedded in a space with dimension j, e.g., 1-D, 2-D,
When the rules of a parallel grammar are linked, 3-D. Stiny (1992) extends the notion of algebras to
the linked rules can be expressed as one compound shapes with attributes: labeled points belong to the
rule (Knight 2003a). Therefore, some authors con- algebra V02 , while weighted line segments belong
sider compound grammars as an alternative term to the algebra W12 . Then, shapes of line segments
to parallel grammars, though others adopt the term and labeled points can be said to belong to an alge-
compound grammars also to denote compositions bra that is the direct product of the algebras U12 and

SHAPE, FORM AND GEOMETRY | Grammars and Concepts - Volume 2 - eCAADe 34 | 331
V02 , U12 ×V02 . Consequently, a shape rule applying the algebra's signature contributes to the module's
to shapes of line segments and labeled points can be interface (the class methods in object-oriented pro-
considered to combine two shape rules, one in U12 gramming), but the interface can be extended to in-
applying to line segments and one in V02 applying clude, among others, the part relation. Nevertheless,
to labeled points. having a (even partially) uniform interface, i.e., shar-
Any selection of shape algebras, including la- ing the same class methods, greatly eases the imple-
beled and weighted shape algebras, can be com- mentation of a general shape grammar interpreter.
bined using the direct product into a compound al- Unfortunately, as Knight (2003b) acknowledges,
gebra of compound shapes that are made up of a "the algebras that designers use, informally or for-
mix of various spatial elements, and optionally aug- mally, are many." Beyond labels and weights, shapes
mented with labels or weights. Chase (1999) notes can be augmented with attributes of any kind: "aes-
that "this is common in maps, as map features may thetic, formal, functional, structural, and so on. For
be distinguished by different element types (for ex- example, points can have diameters, lines can have
ample, lines representing roads, points representing thicknesses, planes can have colors, solids can have
cities), or labels used to distinguish elements with materials" (Knight 2003b). "The only condition is that
the same basic geometry but different semantics (for the operators of any shape algebra are defined on
example, lines can represent roads and rivers)." But, all its elementary objects, are recursively applicable,
examples in architectural representation abound as and are closed" (Yue and Krishnamurti 2013). Fortu-
well. Compound shapes may be expressed in unions nately, the notion of an algebra as derived from exist-
of the sets that form shapes from different algebras, ing algebras can be extended to augmented shapes,
with the understanding that basic and augmented e.g., of labeled points (Stouffs 2008). Defining an al-
spatial elements only interact if they are of the same gebra for labels is straightforward. Similar to points,
kind (same dimension and attribute kind, if any), and a label can be said to be part of another label only
are independent otherwise (Stiny 1992). if these are identical. Then, the operations of sum,
This notion of compound shapes, as resulting product, and difference correspond to the set oper-
from compound algebras defined by the direct prod- ations of union, intersection and difference. Labels
uct of basic shape algebras, is conducive to a modu- do not exhibit any allowable transformations, unless
lar (or procedural) implementation of a shape gram- we consider case transformations. However, the op-
mar interpreter (e.g., Frank 1999). Each basic shape eration of direct product on algebras will not support
algebra can define a single module (or a class in an an attribute behavior, and it is not straightforward to
object-oriented programming paradigm), and mod- consider an alternative operation on algebras. Krstic
ules can be combined to define compound algebras, (1999) offers an unintentional hint.
facilitating a variety of shape grammar formalisms.
The algebra's signature specifies the operations ALGEBRAIC ABSTRACTIONS
of the algebra, at a minimum, the operations of sum Krstic (1999) notes the difference between an alge-
('+'), product ('·'), and difference ('−'). The allowable bra of (maximal) spatial elements and an algebra of
transformations can be considered external to the al- shapes. The former is a partial algebra as the opera-
gebra, as part of the signature or as part of the al- tions of sum, product, and difference are not closed.
gebra's carrier, i.e., the set of elements of the alge- The sum of two spatial elements is a spatial element
bra (Krstic 1999; 2012). The part relation ('≤') is not only if the two elements overlap or are both part of
an operation of the algebra but can be expressed in another spatial element and have boundaries that
terms of the operation of product: t(a) ≤ s ⇔ t(a) · s = overlap. In general, the operations of sum, product,
t(a). From a modular implementation point of view, and difference on spatial elements are only defined

332 | eCAADe 34 - SHAPE, FORM AND GEOMETRY | Grammars and Concepts - Volume 2
if the spatial elements exist in the same subspace, cluding sum ('+'), product ('·'), difference ('−'), and re-
where the dimension of the subspace equals the di- duce ('r') can be defined for a discrete behavior as fol-
mension of the spatial elements. For example, two lows:
line segments must be part of the same infinite line, ∀ X, Y ∈ P(A) ⇒
two plane segments of the same infinite plane, and X +Y =X ∪Y
two volumes of the same 3D hyperplane. This sub- X ·Y =X ∩Y (1)
space is denoted the carrier of the spatial element, X −Y = X \Y
but in order to avoid any confusion with the carrier of r(X) = X
an algebra, we will instead refer to the co-descriptor of
the subspace. Then, the operations of sum, product, In a discrete behavior, the operations of sum,
and difference on spatial elements are defined only product, and difference correspond to the normal set
if the spatial elements have the same co-descriptor, operations of union, intersection and difference. The
that is, they are co-equal. Note from above that, in reduce operation reduces any set to a set of maxi-
and of itself, this is not a sufficient condition for the mal elements. Under a discrete behavior, any set is
operations to be closed. maximal because any duplicates are automatically re-
Having established the difference, Krstic (1999) moved. The algebras U0 (shapes of points; we omit
goes on to focus solely on shape algebras. How- the dimension of the embedding space for simplicity)
ever, it is possible to derive shape algebras from par- and L, sets of labels, can be defined in this way. Note
tial algebras of spatial or other elements in a general that descriptions, from an algebraic point of view, be-
way. First, let us assume a two-sorted partial alge- have exactly as labels and, thus, the algebra D of sets
bra with carrier {A, P(A)} and signature including the of descriptions can be defined in this way as well.
operations of combine, common and complement on Before we address other spatial elements, let us
members of A. We consider a two-sorted algebra be- first consider a behavior for weights (e.g., line thick-
cause we want the operations of combine, common, nesses or surface tones), as is apparent from drawings
and complement to extend upon the respective op- on paper−a single line drawn multiple times, each
erations of sum, product, and difference, and at the time with a different thickness, appears as if it were
same time be closed for co-equal (spatial) elements. drawn once with the largest thickness, even though
For example, the combine of two co-equal spatial el- it assumes the same line with other thicknesses (Stiny
ements that do not have overlapping boundaries will 1992).
be the set of the two spatial elements. Thus, each An algebra with carrier P1 (A), the set of all sin-
of the operations of combine, common, and comple- gleton subsets of A, and signature including sum ('+'),
ment takes as argument two elements of A and return product ('·'), difference ('−'), and reduce ('r') can be
an element of P(A), the set of all subsets of A. defined for an ordinal behavior, applying to weights,
in terms of the two-sorted partial algebra with car-
Deriving Algebras from Two-sorted Partial rier {A, P(A)} and signature including the operations
Algebras of combine, common and complement, as follows:
To derive a shape algebra from this two-sorted partial ∀ {x}, {y} ∈ P1 (A) ⇒
algebra, we need to distinguish the desired behavior. {x} + {y} = combine(x, y)
Each behavior will result in a different derivation. For- {x} · {y} = common(x, y) (2)
tunately, we can reuse behaviors for different kinds of {x} − {y} = complement(x, y)
spatial or other elements. The simplest behavior is a r({x}) = {x}
discrete behavior, applying to both points and labels.
An algebra with carrier P(A) and signature in- For weights, we know that the result of the op-
erations of combine, common, and complement on

SHAPE, FORM AND GEOMETRY | Grammars and Concepts - Volume 2 - eCAADe 34 | 333
two singleton weights is always a singleton weight. the collection of boundaries of co-shape Y that lie
We use this knowledge to define the operations of outside of co-shape X. 'same-side(b(X), b(Y))' denotes
sum, product, and difference in terms of the opera- the collection of boundaries of both co-shapes X and
tions of combine, common, and complement. Again, Y where the interiors of the respective co-shapes lie
the reduce operation results in the argument (single- on the same side of the boundary, and 'opposite-
ton) set itself. The algebra N of singletons of numeric side(b(X), b(Y))' the collection of boundaries of both
weights can be defined in this way. co-shapes X and Y where the interiors of the respec-
Deriving a shape algebra for spatial elements tive co-shapes lie on opposite sides of the bound-
other than points from a two-sorted partial algebra ary. Then, the boundary of the co-shape result-
is a little bit more complicated because of the need ing from the co-combine operation is formed by
to consider co-equal shapes. We take a two-step ap- the 'outside(b(X), Y)', 'outside(b(Y), X)', and 'same-
proach. First, we derive a sub-algebra for co-equal side(b(X), b(Y))' collections, and the co-shape can be
shapes of spatial elements, next we define a shape constructed from the union of these collections. The
algebra for a single type of spatial elements from this co-common and co-complement operations are sim-
sub-algebra. ilarly defined. In the case of the co-reduce oper-
A sub-algebra with carrier P(A) and signature in- ation, each spatial element in the co-shape is co-
cluding co-combine, co-common, co-complement, combined with the co-reduced remainder of the co-
and co-reduce can be defined for an areal behavior shape. From an implementation point of view, this
as follows: recursive definition of co-reduce may not be the most
∀ X, Y ∈ P(A) : efficient; actually, the same can be said about the
∀ x ∈ X, ∀ y ∈ Y , co(x) = co(y) ⇒ other operations−the classification of boundary seg-
co-combine(X,
 Y) =  ments with respect to another co-shape can be com-
∪  outside(b(X), Y )
construct  outside(b(Y ), X)  puted once for all of the classes inside, outside, same-

same-side(b(X), b(Y )) side and opposite-side. Obviously, these definitions
co-common(X, Y) =  only serve as abstractions of the actual procedures,
∪  outside(b(X), Y )
construct inside(b(Y ), X)  (3) we refer to Stouffs and Krishnamurti (2006) for actual,

same-side(b(X), b(Y )) and efficient, algorithms.
co-compliment(X,
  Y)=  Then, a shape algebra with carrier P(A) and sig-
∪ outside(b(X), Y )
construct inside(b(Y ), X)  nature including sum ('+'), product ('·'), difference

opposite-side(b(X), b(Y )) ('−'), and reduce ('r') can be defined for an areal be-
co-reduce(X)
{ =
co-combine({x}, co-reduce(X \ x)) ∃ x ∈ X
havior, applying to line segments, plane segments
∅ otherwise and volumes, in terms of the sub-algebra with car-
rier P(A) and signature co-combine, co-common, co-
The operations of co-combine, co-common, co- complement, and co-reduce, as follows:
complement, and co-reduce only apply to co-equal ∀X, Y ∈ P(A) ⇒
shapes. Instead of comparing the shapes for co- X + Y = r(X ∪ Y ) ( )
∪ {x ∈ X : co(x) = c},
equality, it is checked that all spatial elements have X · Y = c co-common
{y ∈ Y : co(y) = c}
the same co-descriptor ('co'). Then, the operations X − Y ∪= (4)
can be expressed in terms of the boundaries ('b') ∪  c {x ∈ X : co(x) =(c ∧ ¬∃y ∈ Y : co(y) =)c}
∪ {x ∈ X : co(x) = c},
of each co-equal shape (Krishnamurti and Stouffs  c co-complement {y ∈ Y : co(y) = c}

2004; Stouffs and Krishnamurti 2006), here termed r(X) = c co-reduce({x ∈ X : co(x) = c})
co-shape. Specifically, 'outside(b(X), Y)' returns the
collection of boundaries of co-shape X that lie out- The operations of product, difference and reduce
side of co-shape Y. Similarly, 'inside(b(Y), X)' returns are expressed directly in terms of the operations of

334 | eCAADe 34 - SHAPE, FORM AND GEOMETRY | Grammars and Concepts - Volume 2
co-common, co-complement and co-reduce on the Deriving Augmented Shape Algebras
respective co-shapes. In the case of complement, co- Next, we can tackle the issue of an algebra for aug-
shapes from X for which there exists no (co-equal) co- mented shapes. Rather than referring to a shape al-
shape in Y also form part of the result. A similar ap- gebra and an attribute algebra (e.g., L or N ), we will
proach can be taken for the operation of sum, how- instead refer to the partial algebra for the spatial ele-
ever, for simplicity, we prefer to express the opera- ments, just as we define the shape algebra from the
tion of sum in terms of the operation of reduce on partial algebra of its spatial elements. The behav-
the combined sets of spatial elements. Note that the ior of an augmented shape algebra, after all, mimics
algebras U1 (shapes of line segments), U2 (shapes of the behavior of the underlying shape algebra, with a
plane segments) and U3 (shapes of volumes) can all few differences. For example, consider two overlap-
be defined in this way. ping line segments. Without attributes, these com-
We should note that while an areal behavior ap- bine. With attributes, they combine only if they share
plies to shapes of line segments as well, from an im- the same attributes or, otherwise, of the segments
plementation point of view, it would be more effi- are identical. Otherwise, different segments (or parts
cient to define an interval behavior for shapes of line thereof ) will necessarily have different attributes and
segments. Additionally, while these behaviors cover will need to be represented separately. The behav-
shapes of different kinds of spatial elements, and sets ior of the attribute shapes, for each of the different
of labels and singletons of weights, other behaviors line segments (or parts thereof ), however remains
can be identified to apply to other kinds of attributes, the same.
for example, for material rankings (Knight 1993). In- An algebra with carrier P(A × P(B)) and signa-
stead, we will now continue to derive compositions ture including sum ('+'), product ('·'), difference ('−'),
of algebras under the direct product. and reduce ('r') can be defined for a discrete behavior,
in terms of the (attribute) algebra P(B) with signature
Deriving Algebras with the Direct Product including sum ('+'), product ('·'), difference ('−'), and
The direct product applies to all algebras that share reduce ('r'), as follows:
the same signature, specifically, the algebras U0 , U1 , ∀ X, Y ∈ P(A × P(B)) ⇒
U2 , U3 , L, D, and N , we have previously defined. X + Y =
We will address some implications of this in the dis- ∪ {(x, Bx + By ) : (x, Bx ) ∈ X ∧ (x, By ) ∈ Y }
{(x, Bx ) : (x, Bx ) ∈ X ∧ ¬∃(x, By ) ∈ Y }
cussion below. Here, we define a shape algebra with 
{(x, By ) : (x, By ) ∈ Y ∧ ¬∃ (x, Bx ) ∈ X}
carrier P(A) × P(B) and signature including sum ('+'), X ·Y =
{(x, Bx · By ) : (x, Bx ) ∈ X ∧ (x, By ) ∈ Y } (6)
product ('·'), difference ('−'), and reduce ('r') in terms X −{ Y =
of the shape algebras with carriers P(A) and P(B) and ∪ {(x, Bx − By ) : (x, Bx ) ∈ X ∧ (x, By ) ∈ Y }
identical signatures, as follows: {(x, Bx ) : (x, Bx ) ∈ X ∧ ¬∃ (x, By ) ∈ Y }
r(X)
{ =
∀ (A1 , B1 ), (A2 , B2 ) ∈ P(A) × P(B) ⇒ {(x, Bx )} + r(X \ (x, Bx )) ∃ (x, Bx ) ∈ X
(A1 , B1 ) + (A2 , B2 ) = (A1 + A2 , B1 + B2 ) ∅ otherwise
(A1 , B1 ) · (A2 , B2 ) = (A1 · A2 , B1 · B2 ) (5)
(A1 , B1 ) − (A2 , B2 ) = (A1 − A2 , B1 − B2 ) Comparing this to the discrete behavior for a
r(A1 , B1 ) = (r(A1 ), r(B1 )) non-augmented shape algebra, we observe that for
the operations of sum, product and difference, if a
An algebra of shapes of points and line seg- spatial element is shared between both (augmented)
ments, U0 × U1 , and an algebra of shapes of line shapes, we combine both attributes of the spatial
segments and sets of descriptions, U1 × D, among element under the same operation. In the case of
others, can be defined in this way. the operations of sum and difference, we may need
to add spatial elements, with their original attribute,

SHAPE, FORM AND GEOMETRY | Grammars and Concepts - Volume 2 - eCAADe 34 | 335
that belong to one augmented shape but not the entirety. Instead, we need to apply the classifica-
other. We express the operation of reduce in terms tion and construction to each pair of spatial elements
of the operation of sum for the same algebra. An al- from the respective co-shapes, in order to be able to
gebra of shapes of labeled points, V0 , or shapes of assign the appropriate attributes−as defined by the
weighted points, W0 , with the weights representing operation of sum, product or difference applied to
grey-scales or diameters, can be defined in this way. the respective attributes of the spatial elements. This
Having established an augmented shape algebra definition relies on the specification of helper func-
for points, a demonstration of an augmented shape tions 'common-sum', 'common-product', 'common-
algebra for other spatial elements, using the areal be- difference', 'complement', and 'co-r', defined below.
havior, remains. In fact, where the shape algebra for The first three helper functions return the common
an areal behavior is expressed in terms of the sub- shape of two co-equal spatial elements, with as at-
algebra for co-equal shapes, we can define a sub- tribute, respectively, the sum, product and difference
algebra for co-equal augmented shapes and retain of the respective attributes. The 'complement' re-
the definition for the shape algebra as a definition for turns the complement shape of a spatial element
the augmented shape algebra as well. The only diffi- with respect to a co-equal shape, with as attribute
culty is the use of the co-descriptor function ('co') on the original attribute of the spatial element. Finally,
elements of the shape algebra. However, if we over- 'co-r' is a variant of the operation of co-reduce that
load the co-descriptor function to accept augmented assumes that none of the spatial elements overlap,
spatial elements, i.e., elements with attributes, then though they may share boundaries. Two spatial ele-
there is no issue. ments that share boundary may be combined if they
A sub-algebra with carrier P(A × P(B)) and also share the same attribute(s).
signature including co-combine, co-common, co- common-sum(X,
 Y)=  
complement, and co-reduce can be defined for an ∪ ∪   (x, Bx ) ∈ X∧ 
y (z, B x + B y ) : (y, By ) ∈ Y ∧
areal behavior, in terms of the two-sorted partial al- x  
z ∈ co-common(x, y)
gebra with carrier {A, P(A)} and signature including common-product(X,
 Y ) = 
∪ ∪   (x, Bx ) ∈ X∧ 
the operations of combine, common and comple- (y, By ) ∈ Y ∧
x y (z, Bx · By ) :  
ment, and the (attribute) algebra P(B) with signature z ∈ co-common(x, y)
common-difference(X, Y ) =
including sum ('+'), product ('·'), difference ('−'), and  
∪ ∪   (x, Bx ) ∈ X∧ 
reduce ('r'), as follows: (z, B − B ) : (y, B ) ∈ Y ∧
x y x y

y
z ∈ co-common(x, y)
 (8)
∀ X, Y ∈ P(A × P(B)) :
∀(x, Bx ) ∈ X, ∀(y, By ) ∈ Y , co(x) = co(y) ⇒ complement(X,
{ Y{ ) = }
co-combine(X, ∪ (x, Bx ) ∈ X∧
  Y)=  x (z, Bx ) : z ∈ difference({x}, Y )
∪ common-sum(X, Y )
co-r complement(X, Y )  co-r(X) =
  
complement(Y, X) 
    
 (x, Bx ) ∈ X∧
co-common(X, Y ) = 
 {(z,  (y, Bx ) ∈ X∧

 B x )}∪ 
(7) 
co-r(common-product(X, Y )) co-r X\  x 6= y∧
co-complement(X, Y)= 

( { ) 
 {(x, Bx ), (y, Bx )} 
 {z} =
∪ common-difference(X, Y ) 
 
co-r 
 co-combine(x, y)
complement(X, Y ) 
∅ otherwise
co-reduce(X)
 =( )
 {(x, Bx )},
co-combine ∃ (x, Bx ) ∈ X An algebra of shapes of weighted line segments,
co-reduce(X\(x, Bx ))

∅ otherwise W1 , or shapes of labeled plane segments, V2 , among
We cannot simply determine a resulting co- others, can be defined in this way.
shape−from one of the operations of co-combine,
co-common, and co-complement−from the classifi-
cation of the boundaries of both co-shapes in their

336 | eCAADe 34 - SHAPE, FORM AND GEOMETRY | Grammars and Concepts - Volume 2
Discussion of a drawing of line segments and labeled points,
We have adopted a constructive, algebraic approach the segments and points operate in the same (2D or
to defining shape algebras and augmented shape al- 3D) space and transformations of shapes of line seg-
gebras. This allows for a variety of algebras to be de- ments and shapes of labeled points necessarily need
fined from an array of basic (partial) algebras of spa- to go hand in hand. Instead, when shape algebras
tial and other elements. For example, we can de- operate in a different space (or drawing), transfor-
fine an algebra of shapes of line segments and la- mations may differ. The sum of algebras applies in
beled points, U1 × V0 , from basic partial algebras the first case, the (direct) product in the second case.
of points, line segments and labels. Other opportu- However, as we left transformations out of the pic-
nities arise. Rather than restricting ourselves to la- ture, the direct product of algebras as we defined it
bels and weights as attributes, we can consider other is applicable to both cases. We refer to Krstic (2012)
attributes, such as color, in the same way. Consider for a treatment of transformations in the context of
a basic algebra of sets of colors, C, and assume we shape algebras.
express the combination of a shape algebra with an
attribute algebra with the operator '∧', termed attri- CONCLUSION
bution, then we can define an algebra of shapes of We presented an algebraic approach to describing
colored plane segments as U2 ∧ C. Similarly, we compound shapes that includes the definition of
can then write V0 = U0 ∧ L and W1 = U1 ∧ non-spatial algebras and the combination of shape
N . Additionally, we can define an attribute algebra algebras and non-spatial algebras under an opera-
as a direct product of two basic attribute algebras, tion of attribution. This algebraic abstraction serves
e.g., U0 ∧ (L × N ) defines an algebra of shapes of as a procedural abstraction for the modular imple-
points with both labels and weights as attributes. We mentation of a general shape grammar interpreter.
may consider the operation of direct product to dis-
tribute over the operation of attribution, resulting in
(U0 ∧ L) × (U0 ∧ N ) = V0 × W0 .
REFERENCES
Beirão, JN 2012, CItyMaker: designing grammars for urban
While we commonly consider algebras of shapes
design, Ph.D. Thesis, Delft University of Technology
augmented with algebras of (sets of ) non-spatial Chase, SC 1999, 'Supporting emergence in geographic
elements, and the direct product of (augmented) information systems', Environment and Planning B:
shape algebras, other combinations are possible as Planning and Design, 26(1), p. 33–44
well. Consider the algebra D of sets of descriptions. Duarte, JP 2001, Customizing mass housing: a discursive
Though it is a non-spatial algebra, most authors con- grammar for Siza's Malagueira houses, Ph.D. Thesis,
MIT
sider descriptions parallel to drawings, not as at-
Duarte, JP 2005, 'Towards the mass customization
tributes thereof. Nevertheless, Beirão (2012) consid- of housing: the grammar of Siza's houses at
ers descriptions as attributes to spatial objects, allow- Malagueira', Environment and Planning B: Planning
ing for objects to refer to alternate, though similar, and Design, 32(3), p. 347–380
descriptions. Thus, U1 × D is as valid as U1 ∧ D. Of Frank, AU 1999, 'One step up the abstraction ladder:
course, some limitations in the way we combine alge- combining algebras', in Freksa, C and Mark, DM (eds)
1999, COSIT’99, LNCS 1661, Springer, Berlin, pp. 95-
bras may still be preferable, reflecting on the kinds of
108
design descriptions (whether drawings or other de- Gips, J 1975, Shape Grammars and their Uses: Artificial Per-
scriptions) we tend to use. ception, Shape Generation and Computer Aesthetics,
Knight (2003b; see also, Krstic 2012) also con- Birkhäuser, Basel
siders a sum of algebras that requires algebras to be Knight, TW 1989, 'Color grammars: designing with lines
specified in the same space. For example, in the case and colors', Environment and Planning B: Planning
and Design, 16(4), p. 417–449

SHAPE, FORM AND GEOMETRY | Grammars and Concepts - Volume 2 - eCAADe 34 | 337
Knight, TW 1993, 'Color grammars: the representation matics, 22(1), pp. 71-89
of form and color in design', Leonardo, 26(2), p. Stouffs, R and Krishnamurti, R 2006, 'Algorithms for clas-
117–124 sifying and constructing the boundary of a shape',
Knight, TW 1999 'Applications in architectural design, Journal of Design Research, 5(1), pp. 54-95
and education and practice', NSF/MIT Workshop on Yue, K and Krishnamurti, R 2013, 'Tractable shape gram-
Shape Computation, report, Cambridge, MA mars', Environment and Planning B: Planning and De-
Knight, TW 2003a, 'Computing with emergence', Envi- sign, 40(4), p. 576–594
ronment and Planning B: Planning and Design, 30(1),
p. 125–155
Knight, TW 2003b, 'Computing with ambiguity', Environ-
ment and Planning B: Planning and Design, 30(2), p.
165–180
Knight, TW 2004 'Interaction in visual design computing',
Visual and Spatial Reasoning in Design III, presenta-
tion, Cambridge, MA
Krishnamurti, R and Stouffs, R 2004, 'The boundary of
a shape and its classification', Journal of Design Re-
search, 4(1)
Krstic, D 1999, 'Constructing algebras of design', Environ-
ment and Planning B: Planning and Design, 26(1), pp.
45-57
Krstic, D 2012, 'Algebras of shapes revisited', in Gero,
JS (eds) 2012, Design Computing and Cognition ’12,
Springer, Dordrecht, p. 361–376
Li, AI 1999 'Expressing parametric dependence in shape
grammars, with an example from traditional Chi-
nese architecture', Proceedings of CAADRIA 1999,
Shanghai, p. 265–274
Li, AI 2001, A shape grammar for teaching the architectural
style of the Yingzao fashi, Ph.D. Thesis, MIT
Li, AI 2004, 'Styles, grammars, authors, and users', in Gero,
JS (eds) 2004, Design Computing and Cognition ‘04,
Kluwer, Dordrecht, p. 197–215
Stiny, G 1975, Pictorial and Formal Aspects of Shape and
Shape Grammars, Springer, Basel
Stiny, G 1980, 'Introduction to shape and shape gram-
mars', Environment and Planning B: Planning and De-
sign, 7(3), pp. 343-351
Stiny, G 1981, 'A note on the description of designs', En-
vironment and Planning B: Planning and Design, 8(3),
p. 257–267
Stiny, G 1990, 'What is a design?', Environment and Plan-
ning B: Planning and Design, 17(1), p. 97–103
Stiny, G 1992, 'Weights', Environment and Planning B:
Planning and Design, 19(4), p. 413–430
Stiny, G and Gips, J 1972, 'Shape grammars and the gen-
erative specification of painting and sculpture', in
Freiman, CV (eds) 1972, Information Processing 71,
North-Holland, Amsterdam, p. 1460–1465
Stouffs, R 2008, 'Constructing design representations us-
ing a sortal approach', Advanced Engineering Infor-

338 | eCAADe 34 - SHAPE, FORM AND GEOMETRY | Grammars and Concepts - Volume 2

Anda mungkin juga menyukai