Sunteți pe pagina 1din 32

Environment and Planning B: Planning and Design2016, volume 43, pages 152183

doi:10.1177/0265813515610671

An Introduction to Shape Schema Grammars

Robert Woodbury
School of Interactive Arts and Technology Simon Fraser University Surrey 250 - 13450
102nd Avenue Surrey, BC V3T 0A3 Canada;
e-mail: rw@sfu.ca
Received 07 April 2014; in revised form 28 October 2014

Abstract. Shape schema grammars generalize parametric shape grammars so that both
rules and the objects to which they apply are expressed with shape schemata. This paper
defines shape schema grammars. It starts with a notation for schemata in general and
shape schemata in particular. Schema equality is shown to have at least three possible
definitions, of which schema consistency is the most useful. A limited notion of shape
schema maximality potentially reduces the size and redundancy of a given schema. Shape
schema subpart is a multifunction returning all of the possible ways that one shape
schema can be embedded in another. Shape schema difference and addition complete the
basic mathematical operations over shape schemata required to define shape schema rules,
grammars and languages.

Keywords: shape grammars, parametric shape grammars, design grammars, generative


design

1 Introduction
This paper introduces shape schema grammars, in which rules and the representations
over which they operate remain schemata throughout a computation. First, a few
observations. Virtually all published shape grammars are parametric shape grammars.
Apparently conventional shape grammars are not very appealing in practice. Yet all of
the published general shape grammar interpreters are conventional, notwithstanding
a few heuristic-based programs such as (McCormack and Cagan, 2002). Apparently
parametric shape grammars are difficult to implement. The distance between the
representations researchers want to use and those they can use in practice is ever larger:
virtually all of the published design grammar interpreters work across representations
that lack, in some way, the property of emergence in their representations (Mller
et al., 2006) (though this can be argued in systems such as Genesis (Heisserman,
1994; Heisserman and Woodbury, 1993; Heisserman, 1991) and SEED-Config (Akin
et al., 1997; Flemming and Woodbury, 1995)). Consequently, researchers can (and
do) devise grammars but cannot readily use those grammars to generate designs,
having to write special-purpose, often unvalidated, code to do so (Flemming,
1987; McCormack and Cagan, 2002). Since, in general, little can be known of a
design space (the language of a grammar) from examination of the grammar alone,
grammatical design researchers are limited in the insight they can gain from their
work. Yet researchers who have used a grammar interpreter in creating grammatical
understandings of designed artifacts will attest to the usefulness of doing so, see
(Flemming, 1987).
An Introduction to Shape Schema Grammars 153

Thus the grammatical research community lacks an important capabilitya general


purpose interpreter that acts parametrically over shape-like objects. I use the terms
parametrically and shape-like advisedly, informally capturing respectively the
notions of doing simultaneous computations over a set of related variations and
denite objects having indenite subparts.
Other issues arise in using grammars to compute designs. First, it is typical that a
body of designs can be grouped into categories on the basis that they are dimensional
variations of each other. This is the basis of parametric computer-aided design systems
that have become commonplace in practice. Both conventional and parametric shape
grammars would require that each member of a category be computed individually.
Since categories can be indenumerably innite, so can computations over their
members. It would be useful to be able to apply grammar rules to entire categories
at once. Indeed such a capability is essential when grammars are used in conjunction
with parametric systems.
Second, shapes are often used in application to represent specic geometric
constructs. Shapes may be incomplete or partial with respect to the grammar
that uses them, but their location in space must be completely specied. Notions of
incompleteness in a grammatical derivation must be dealt with through addition of
new parts of a shape or modication of existing parts. There is no inherent notion
of partiality, yet this would seem important to the enterprise.
This brings me to the motivation for this paper. A grammar system with parametric
rules that act over parametric objects could both enable further inquiry with
parametric shape grammars and extend the reach of shape grammars into the now
commonplace (arguably dominant) parametric representations used in computer-aided
design.
Shape schemata are objects that capture a class of shapes by assigning variables to
the structure of a shape and giving a set of constraints over the variables. Any
assignment of specic values to the variables creates a (possibly reducible) shape
and any such assignment that is consistent with the constraints of a schema is an
instance of the schema.
Parametric shape grammars create rules out of schemata. A parametric shape
grammar rule captures a potential innity of standard shape grammar rules.
Applying a parametric shape grammar rule requires nding one of the represented
shape grammar rules and then applying it according to the conventions of shape
grammars.
Shape schema grammars admit representation of rules as schemata and allow those
rules to operate themselves over schemata. In operation, they map from schema to
schema. This paper sketches the machinery of shape schema grammars. It provides
denitions for schemata, shape schemata, relations including equality, maximality and
subpart, rules and ultimately shape schema grammars. In doing so it provides a logical,
though intractable, algorithm for computing shape schemata using shape schema
grammars. It further develops a conference paper (Li et al., 1998) and a short paper
presented at a workshop (Woodbury, 2002).

2 Notation
S
N denotes the natural numbers, the set f1, 2, . . .g. N0 is the set N f0gthe natural
numbers starting at 0. For n 2 N, n is the set f1, . . . ng. 0 is the empty set .
154 R Woodbury

We distinguish two types of collections: sets and ordered tuples.


S fa, b, cg is the set S comprising a, b and c.
T ha, b, ai is the ordered tuple comprising a, b and a. Ordered tuples may contain
duplicates.
Collections have an associated index set n or, equivalently, fname1 , . . . , namen g, where
n is the number of elements in (the cardinality of) the collection. Thus Si refers to the ith
element of S. The function tupleS is the ordered tuple generated by the set S taken in
the order given. The function setT is the set generated by removing duplicates from
the ordered tuple T. Note that setT is not guaranteed to preserve the order given in T.
Thus, as duplicates are removed and order is not preserved, in general
tuplesetT 6 T. However, it is always true that settupleS S.
The following functions are dened over collections:
j Cj the cardinality of the collection C.
m C a subset containing m elements of the set C.
PC the powerset of the set C.
C a tuple giving a permutation of the set C.
SC the set of all permutations of C, the symmetric group of C.
r(C) a tuple giving a right permutation of the collection C. Two tuples are
symmetric if they are of the same length and the order of their elements is
exactly reversed. Thus the tuple ha, b, ci is symmetric with hc, b, ai. Every
permutation of a set C has exactly one corresponding symmetric tuple,
which is also a permutation of C. These two tuples comprise a symmetric
permutation pair set of C. Given an index set for C, a right permutation of
a symmetric permutation pair is that tuple starting with an element of greatest
index. The set of right permutations of a set C is the set formed by taking the
right permutation of each symmetric permutation pair set of C.
C a partition of the set C.
C a partition of the set C into n blocks.
n

Further we presume a nite set of types Type, the classes Real, Bool f0, 1g, Collection
and Schema, and variables over these classes. We use the following notation:

a,b,r,x real, Boolean and shape variables (lowercase, italic).


a, ^ r^, x^
^ b, schema variables (lowercase, italic, hatted).
a, _ r_, x_
_ b, schema instance variables (lowercase, italic, dotted).
A,B,R,X collection variables (uppercase, italic).
A, B, R, U universes, collection variables describing a domain of interest (calligraphic).

3 Schemata
A schema s^ comprises a type, an object and a set of constraints and is described as the
following
thO, Ei
where t is the type of the schema, O the object of the schema and E the constraints of the
schema (we use E for Equations as the obvious C nds use elsewhere). The type is drawn
from Type. For every type t 2 Type there is a xed structure for O, either a single variable,
An Introduction to Shape Schema Grammars 155

a tuple of schemata (each with a type) or a set (of possibly variable cardinality) of
schemata of the same type, yielding respectively a basic, tuple or set type.
Schemata whose objects are taken from O are called sub-schemata of s^. A path is a
tuple of indices and is interpreted with respect to a schema by using successive elements
of the path to access corresponding sub-schemata of the schema. In this paper, paths
are short, so we use successive subscripts, that is, a^ ij to denote the object at the end of
^ ji or a:i:j.
the path a:hi, ^ Further, for typographical clarity, we use the single notation a^ij
to denote both a^ij , the object at the end of the path, and abij , the schema named by the
path. The contained variables of a schema a^ comprise the variables accessible by
following paths from a. ^ An equivalent denition of the contained variables of a
non-basic schema a^ are the variables found in the sub-schema of a^ that are typed to
basic types. We omit the nal element of any path accessing a contained variable
(which should be O to access the object of the basic schema at the end of the path).
The constraints of a schema are expressions over its contained variables and may
employ other variables local to E.
Types thus act as templates by which schemata can be created by assigning specic
structures to O. A schema acts as a template by which instances can be created by
assigning specic values to the variables of the schema that are consistent with the
constraints of the schema. Instances of a basic type are called basic instances, and
similarly with tuple and set types.
By convention, instances can be written without constraints, so that realh5i is an
instance of a real schema with value 5. Schemata with null constraint sets can also be
written without constraints, so that realhai is a real schema with no constraints, i.e., a
real schema whose value can be any real. A ground schema has only one instance, i.e.,
all of its contained variables admit only a single value.
As objects, schemata behave intensionally, that is, identity between schemata is
token identity as dened by Carpenter, (1992, Ch. 8). As such, there is no formal
notion of schema equality beyond token identity. This is in contrast to extensional
behaviour in which two identical schemata would be taken to represent the same object
in the world. In contrast, standard shapes are almost completely extensional: a
maximal line represents and is the only representation for an actual line in a shape.
In Section 4.5 the operation of necessary reduction will be shown to recover a limited
notion of extensionality for shape schemata.
Schemata are accessed with the following functions.
t^s the type of s^.
O^s the object dened in s^.
E^s the set of constraints dened in s^.
E ^s the set of constraints obtained by concatenating E^s and E v for all v 2 O^s.
^s an instance of the schema s^. ^s can also be written as s_. Every instance of a
schema s^ must satisfy E ^s.
I ^s the instance set of s^the set of all instances of the schema s^. I ^s is a universe
because its members are pointsets.
A schema is satisable if it has at least one instance, or equivalently, if its constraints
are solvable, or equivalently, if its set of instances is non-null, that is, I ^s 6 .
The set of all schema of a particular type t is called the universe of t and is
denoted by b Ut . The powerset of a universe b Ut (comprising all sets of a type t) is
b
denoted 2 . The n-ary Cartesian product of b
Ut
Ut is denoted b U n and the set of all
t
tuples of b
Ut is denoted b
UtN .
156 R Woodbury

4 Shape schemata
Shape schemata are built from line, point and real schemata.
A real schema has the form
realhr, Ei
where r is a real variable and E is a set of constraints over the variable r. For example,
s^ realhr, f0 < r, r  4gi
denotes a real schema for which I ^s comprises all values greater than zero and less
than or equal to four.
A point schema has the form
^ yi,
pointhhx, ^ Ei
where x^ and y^ are real schemata and {x, y} acts as an index set. The point schema p^
expands to
p^ pointhhrealhr, Ri, realhs, Sii, Ei
where E p
^ R [ S [ E. The set E can contain constraints naming both r and s, while
the set R can refer only to r and S only to s.
A line schema has the form
d Ei
d endg,
linehfstart,
d and end
where start d are point schemata. It expands analogously to point schema as
d and end
above. As will be explained later, the point schemata start d are geometrically
unoriented in a line schema. Nonetheless, the elements of the index set {start, end}
serve to access the rst and second elements of a line schema.
The function p, ^ describes a set of constraints that places a point schema on a
^ l
line schema.
^ fp^ l^start tl^end  l^start g
^ l
p,
^ gives the parameter t from the above equation.
^ l
The function tp,
We overload  to also express constraints that place a line schema on another line
schema.

l^1 , l^2 fl^1start , l^2 [ l^1end , l^2 g


The function  p^1 , p^2 , l^ describes a singleton constraint set that places two point
schemata on a line schema (if they are not already so constrained) in a specic
ordering between the start and end of the line schema.

^ ftp^1 , l
 p^1 , p^2 , l ^  tp^2 , lg
^

A shape schema has the form

shapehfl^1 , . . . , l^n g, Ei
where l^1 , . . . , l^n are line schemata and n acts as an index set. Note well that the line
schemata in a shape schema form a set, not a tuple: their order does not matter in
dening the shape schema.
An Introduction to Shape Schema Grammars 157

A shape schema instance is a shape. A line schema instance is a line. A point schema
instance is a point.

4.1 Drawing shape schemata


We draw shape schemata and instances of shape schemata by drawing their constituent
line segments with explicit endpoints. Figure 1 shows that line schemata are drawn
with open circles at their startpoints and open diamonds at their endpoints. Figure 2
shows how this convention helps disambiguate line schemata and their orientations
when a drawing has coincident points. Further, line schemata are drawn with tapered
shading along the right hand side of the schema. This highlights line orientation.
When drawing a schema, we locate its elements arbitrarily, or introduce specic
conventions for showing the range of variation allowed by the schema constraints.
Figure 3 shows a schema comprising a single line, the startpoint of which is constrained
to be within a rectangle, and the endpoint of which must lie within a circle. Figure 4
shows two constrained regions rendered as a sample of points that meet the
constraints.
Figure 4 shows that it is important to distinguish between the start and end of a line
schema as the parametric line equation dening line schemata itself makes this
distinction.
Any element s_ of the instance set I ^s of a shape schema s^ from b
U1, 2 is a shape in U 1, 2
(Stiny, 1991), and thus can be visualized by embedding its lines into a two dimensional
Euclidean space. The schema s^ can be informally visualised by selecting a

Figure 1. (i) Line schemata are drawn with open circles as their startpoints and open diamonds at their
endpoints, and with shading along the right-hand side of the line (going from start- to endpoint). The actual
start- and endpoint of a schema are the centroids of the circle and diamond respectively. (ii) Line schema
instances have filled endpoints. Patterns and weights identify particular line schemata and their instances, for
example, the grey schema corresponds to the grey instance. In the upper instance, line instance b_ (an instance of
^ is a sub-line of line instance a_ (an instance of a^ ) and is shown graphically as embedded within it. In the lower
b)
instance, the embedding relationship is reversed: line instance a_ is embedded in line instance b._ Both cases may
^
be possible for a given a^ and b.
158 R Woodbury

Figure 2. Drawing line schemata with an open circle at the startpoint and an open diamond at the endpoint
supports reading line schemata displayed with coincident start and endpoints. Line schema a^ goes from p^ to q^ , b^
from q^ to ^r, c^ from s^ to q^ , and d^ from r^ to p^ .

Figure 3. The endpoints of the line schema a^ are constrained to lie within the dotted areas shown.

Figure 4. Line schemata are asymmetric with respect to their start- and endpoints. (i) The line schema a^ starts
at p^ and ends at q^ . Another line schema b^ is orthogonal to a^ , starts at r^, one-third of the distance between the
startpoint and endpoint of a^ and q^ and is one-half of the length of a^ . (ii) Reversing the start- and endpoints of a^ ,
yields a line schema a^ 0 producing a different instance set for its related schemata: I b^ end 6 Ib^ 0end .
An Introduction to Shape Schema Grammars 159

Figure 5. Schema may be visualized by drawing the schema as if it were an instance. All subfigures (i), (ii), (iii)
and (iv) render the same schema.

representative instance s_ of s^. Figure 5 shows four dierent visualizations of the same
shape schema.

4.2 Schema subpart


A subpart schema has the form
subparthhC, Ti, Ei
where C hC1 , . . . , Cm i comprises tuples of line schemata and T ht^1 , . . . , t^m i
comprises line schemata. {C, T} functions as an index set for subpart schemata.
A match schema has the form
matchhh^s, Ri, Ei
where s^ is a subpart schema and R h^r1 . . . r^n i comprises line schemata.
{s, R} functions as an index set for match schemata. Further, for a given match
schema m^ the functions subpartm
^ returns s^, and rhsm ^ returns R.
A rule schema has the form

rulehhl,^ r^i, Ei
160 R Woodbury

where l^ and r^ are shape schemata and {l, r} is an index set. The constraints of a shape
schema rule describe how l^ and the r^ are related to each other. Further, for a given rule
schema w^ the functions lhsw^ returns the left hand side, and rhsw^ returns the right
hand side of the rule.
Building on the Stinys notation (Stiny, 1991), we use the following shorthand to
denote the universes and Cartesian products of the above types.

Schema of type Universe n-ary Cartesian product


real b
Ur b
Urn
point b
Up b
Un p
line b
Ul b
Uln
shape b
Us b
Un s
b
Ui, j b
Ui,n j
subpart b
Uv b
Uvn
match b
Um b
Un m
rule b
U ! b
U n!

A rule schema r^ is a b
Ui, j rule schema when both r^lhs and r^rhs are in b
Ui, j .

4.3 Schema equality and consistency


In place of the usual notion of equality, we dene three ways of comparing schemata
with each other: token identity, equality and consistency. Token identity requires that
the compared schemata are actually the same schema. Informally, equality provides a
comparison based on information equivalence; whilst consistency measures whether
two schemata can be combined into a single satisable schema.
Two schemata are equal when, under some identication of sub-schemata, the
instance sets of the two schemata are equal.

a^ b^ iff I a ^
^ I b
Two schemata are consistent when, under some identication of sub-schemata, the
instance sets of the two schemata intersect.

a^ b^ if I a ^ 6 
^ \ I b
These denitions require the specication of how the sub-structures of the argument
schemata are to be identied. The three kinds of schemata (basic, tuple and set) each
have their own identication method.
Basic The single item of a basic schema is given by its contained variable. Therefore
two basic schema are identiable if they are of the same type.
Tuple Two tuple schemata are identiable if they are of the same type, if their cardinality
is the same and if each of the members of the tuples can be pairwise identied.
Set Two set schemata a^ and b^ are identiable if they are of the same type, if they are of
the same cardinality, and if some permutation b ^ of b^ can be identied with the tuple
^ ^
tuplea generated from a in the order given.
From the rules above can be generated sets of identication equations ID ida, ^
^ b
between two schemata according to the following. Let
denote the identication of
two variables.
An Introduction to Shape Schema Grammars 161

Basic For two identiable basic schemata a^ and b^

a^ tha, Ca i and b^ thb, Cb i, ID fa


bg
Tuple For two identiable tuple schemata a^ and b^

a^ thha^ 1 . . . a^n i, Ca i and b^ thhb^1 . . . b^n i, Cb i,


[ [
ID fida^1 , b^1 ... ida^ n , b^n g:

Set For two identiable set schemata a^ and b^

a^ thfa^ 1 . . . a^n g, Ca i and b^ thfb^1 . . . b^n g, Cb i,


Let D SOb ^
ID 2 fidA, BjA tupleOa ^ and B 2 Dg:
Equality requires that every instance of one of the candidate schemata be equal to a
corresponding instance from the other. It is an equivalence relation, so is formally akin
to usual conceptions of equality.
Consistency requires merely that the two schemata have at least one instance in
common. This relation is reexive, symmetric but not transitive.
An alternative formulation for schema consistency under the above identication
denitions uses constraints rather than instance sets.

a^ b^ if E a ^ [ ida,
^ [ E b ^
^ b is solvable

4.4 Line schema orientation


Line schemata are inherently unoriented with respect to any coordinate systemthe
orientation of an instance of a line schema is given by the actual values taken by the
variables of the schema. A single line schema may stand for instances with dierent
orientations.
As set schemata, line schemata are also unoriented: the point schemata of a line
schemata l^ might appear in any order without aecting I l. ^ Nonetheless, in the
specication of the sub-part relation in Section 4.6, line schemata and collections of
them are treated as having a particular orientation by considering, for a particular
l,^ l^start to be the start of the line schema and l^end to be the end of the line schema.
The function  : U l^ X Bool ! U l^ relates line schemata opposite in orientation but
otherwise identical.
d Ei, 0 linehfstart,
d endg,
linehfstart, d Ei
d endg,
d Ei, 1 linehfend,
d endg,
linehfstart, d startg,
d Ei

Uln X b
We overload  as the multifunction  : b n
UBool ! b
Uln where

fl^i , . . . , l^n g, fb1 , . . . bn g fm^ i jm^ i l^i , bi , i 1 . . . ng

^ to denote l,^ b where l^ is a line schema and b 2 Bool and


Further, we write l
L to denote L, B where L is a tuple of line schemata and B 2 b jLj
UBool . We say that
^ produces pairs of extreme points of l.^
l
162 R Woodbury

4.5 Shape schema maximality


In the shape grammar literature, shapes are almost fully extensional with respect to the
point sets that they model. Consider that any shape is, in eect, a name for a particular
point set. Given two shapes a and b, a v b iff a b and a b iff a v b and b v a
or equivalently a b, where x is the point set named by x.
The maximal line representation (Stiny, 1980) for shapes ensures that, with respect
to these point sets, each point is represented exactly once within a set of co-linear lines,
and the reduction rules that achieve the maximal line representation eectively remove
multiple references to the same point within each set of co-linear lines. The exception
that denies full extensionality to shapes occurs when lines cross. Between sets of
collinear lines, points may occur more than once, that is, when two lines cross, the
intersection will be in the point set represented by both lines. The reduction rules on
shapes and the operations of shape union, intersection and dierence on the point sets
of shapes recover full extensionality for shapes.
Shape schemata represent classes of shapes, and should capture this extensional
behaviour, to the extent that it is common across the elements of the class. Within a
shape schema, no two line schemata, in whole or in part, should represent exactly the
same set of line instances. Notice the should in the previous sentenceit indicates
that this ideal state is dicult to achieve and foreshadows that we will develop a partial
response to it. First though, consider two line schemata a^ and b^ within a shape schema
s^. In an instance s_ of s^, a^ has instance a_ and b^ has instance b.
_
_ then a^ eectively occurs twice in
If, in every instance s_ of s^, a_ is co-incident with b,
the shape schema s^.
If, in every instance of s_ of s^, a_ has an extreme point a_p2fstart, endg on b_ and b_ has an
extreme point b_q2fstart, endg on a_ and is collinear with a,_ then the line schema from a^p to
b^q occurs twice in s^.
The necessarily maximal representation of a shape schema is one that removes such
multiple references to parts of instances. It comprises a nite set of line schemata such
that no two can be necessarily reduced to form a single line schema.
In a shape schema s^ containing the point schema p^ and the line schema l,^ p^ is
necessarily coincident with l,^ p^ #l^ if, in every instance of s^, p^ is on l.^ In terms of
constraints this can be stated as a double negation p^ #l^ iff :p^  l, ^ where p^  l^
^
is :p ^
l.
Under necessary maximality, two line schemata a^ and b^ combine to form a single
line schema by the following necessary reduction rules as follows.
Rule 1. See Figure 6. Schema b^ is removed from the representation, but its constraints are kept,
^ Thus, line schema a^ and b^
whenever both of its extreme points are necessarily coincident with a.
become

a^ linehfa^ start , a^end g, Ea ^


^ [ Ebi
With respect to elements of X 2 l, ^ let the function pointX be X^ start and the
^
function other pointX be Xend . Thus, applied to the members of l, ^ pointX and
other pointX work in concert to successively produce lines in their two orientations.
Rule 2. See Figure 7. Line schema

l^ linehfpointa, ^ Ea
^ pointbg, ^
^ [ Ebi
An Introduction to Shape Schema Grammars 163

Figure 6. Necessary reduction Rule 1 removes line schema b^ and combines its constraints with those of a^ .
Line schemata a^ and b^ are offset from their actual coincidence for visual clarity.

Figure 7. The four ways that two line schemata can combine with necessary reduction Rule 2. Line schemata
a^ and b^ are offset from their actual coincidence for visual clarity. Of course, at most one of these conditions can
occur for two given shape schemata, and there may be no necessary reduction at all.

replaces a^ and b^ whenever all of the following apply: other pointa ^ is necessarily
^ other pointb
coincident with b, ^ is necessarily coincident with a^ and other pointa
^ is
necessarily coincident with l.^ The last condition is needed when a^ and b^ necessarily
overlap on a single point, that is, when they share only a single extreme point
necessarily in common. As in Rule 1, the constraints of both line schemata are kept.
The necessary reduction of a shape schema s^, written nr^s, is gained by recursive
pairwise reduction of its constituent line schemata.
164 R Woodbury

Figure 8. Missed reduction. a^ and b^ will not reduce even though the segment from b^ start r^ to b^ mid is necessarily
coincident with a^ . In this case s^ is necessarily on the line represented by a^, but either s^ is between p^ and q^ , or q^ is
between b^ mid and s^. Line schemata a^ and b^ are offset from their actual coincidence and the constraint region of s^ has
finite thickness for visual clarity.

Earlier, we noted that full extensionality over shape schemata is dicult to achieve.
Consider the two shape schemata in Figure 8. Both the startpoint and the midpoint
of b^ are explicitly constrained to be on a^ (and are therefore necessarily coincident with
^ The endpoint of b^ can either be on or not on a.
a). ^ Clearly the part of b^ from b^start to
b^mid is doubly represented, yet a^ and b^ are not necessarily reducible. This pair of line
schemata could be represented as the two schemata a^ and c^ linehfb^mid , b^end gi.
Discovering this and similar reductions seemingly can only be done by doing
algebraic theorem proving over the constraint set of a schema.
Necessary reduction partitions a shape schema into a set of mutually necessarily
irreducible line schemata.
In addition to necessary maximality we can dene another notion of constraint
maximality or just maximality in which coincidence is substituted for necessary
coincidence in the denition above, forming constraint reduction rules or just
reduction rules. There may be multiple constraint maximal representations of a shape
schema, that is, taken together, the constraint reduction rules are a multifunction.
Collectively the constraint maximal representations of a shape schema cover
(perhaps multiply) all instances of the original schema.
In essence, the discussion on schema subpart below describes the constraint maximal
representation for shape schemata.

4.6 Schema subpart


With the subpart relation v over schemata we capture the intuition that one schema is a
subpart of the other if at least one of its instances is a subpart of an instance of the other.
The reason for choosing such an apparently permissive denition is that subpart is the
primary mechanism at play in rule matching, which should have the behaviour of
uncovering all match possibilities. The notion of instance subpart is dependent on the
schema type under consideration. For the schema types considered here, the following are
denitions of instance subpartthese essentially follow the standard notions of subpart for
shapes. We use c to represent the candidate object that is a subpart of t, the target object.
For instances of real schemata c_ realhci and t_ realhti where c and t are taken as
specic real numbers
c_ v t_ if ct
For instances of point schemata c_ pointhhcx , cy ii and t_ pointhhtx , ty ii where cx, cy,
tx and ty are taken as specic real numbers
c_ v t_ if cx tx and cy ty
An Introduction to Shape Schema Grammars 165

For instances of line schemata c_ linehfc_start , c_end gi and t_ linehft_start , t_end gi where
c_start , c_end , t_start and t_end are taken as point instances
c_ v t_ if c_start t_ and c_end t_
For instances of shape schemata c_ shapehfc_1 , . . . , c_m gi, t_ shapehft_1 , . . . , t_n gi where
c_i and t_i are taken as line instances
c_ v t_ if _ v reductiont_
reductionc
where reductionx is the maximal line representation of the shape instance x and v is
the usual shape grammatical notion of subpart (Stiny, 1980).
Implicit in the instance subpart relations for lines and shapes are total orderings that
resolve exactly how one instance is a subpart of the other (Krishnamurti, 1980). In the
case of lines, the order of the endpoints of one line embedded in another is
unambiguously given by the coordinate values of the points involved. In the case of
shapes in U 1, 2 , the set of lines comprising a shape is partitioned by a collinearity
equivalence relation (which is totally ordered) and, within each such equivalence
class, is totally ordered by the order that points appear along the carrier line of the
equivalence class (Krishnamurti, 1980). These orderings need to be captured in a
representation of the subpart relation over line and shape schemata if that subpart
relation is to be used in rule application. For example, consider two line schemata c^
and t^ for which c^ v t^. At the instance level it is either the case that
t_start  c_start  c_end  t_end or t_start  c_end  c_start  t_end , where  is with respect to the
distance (or, equivalently, the point-on-line parameter) along t_ measured from t_start to
t_end . For shape schemata, distinctions are created by the reductions of both schemata.
Further, Figure 9 shows that it may be the case that s^ v t^ and t^ v s^ both hold. The
number of subpart matches for Figure 9(iii) needs explanation. In Appendix A, Table 1
summarizes the top-level categories that occur in the matching process, while
Figures 20, 21 and 22 demonstrate each category. The remainder of the appendix
explains each category in detail.
The subpart relation over shape schemata is the partial multifunction

v: bUi, j X b
Ui, j ! b Uv
that captures the existence of at least one occurrence of instance subpart between instances
of the schemata involved. Its result as a subpart schema describes classes of such instances
each of which admit a single common representation, as a schema, for all of its instances.
Subpart schemata returned by v must capture the order information necessary to
unambiguously characterise a class of instance reductions up to collinear equivalence
classes and maximal line orderings in an equivalence class. This bears explanation.
Consider a pair of unreduced shapes c and t such that reductionc v reductiont
and such that c 2 I c ^ and t 2 I t^. s^ v c,
^ t^ captures explicitly as constraints the
information that describes how the lines of c and t are reduced to maximal lines, and
how maximal lines from c are embedded in maximal lines from t. In order to abstract
across a class of instances, we must do this as orderings, i.e., without reliance on
coordinate values. Thus, from a shape perspective, in the shape schema subpart
relation s^ v c, ^ t^ we need to characterise the following:
1. how lines from c^ and t^ are reduced to maximal lines,
2. which maximal lines from t^ suer which maximal lines from c^ embedded within
them, and
166 R Woodbury

Figure 9. The shape schema subpart relation can go both ways: s^ v ^t and ^t v s^ may both hold. (i) s^ is
constrained to be an equilateral triangle, of fixed or variable size. ^t comprises three unconstrained line schemata.
(ii). One of 48 possible s^ v ^t. (iii) One of 1578 possible ^t v s^. Due to shape reduction and line schema
orientation, the number of subpart matches can grow explosively.
An Introduction to Shape Schema Grammars 167

3. as an ordering, how multiple maximal lines from c^ are embedded in a single


maximal line from t^.
Still within a shape view we note that, if c v t, not all maximal lines from t need have
embedded maximal lines from c and such lines are irrelevant to characterising how a
subpart relation occurs. In the schema version of subpart s^ need record only the maximal
lines from c and how they are embedded in each receiving maximal line from t.
Any maximal line from the shape t might have several maximal lines from the shape
c embedded in it, For each maximal line from t that has maximal lines from c
embedded within it, s^ must record the ordering along the carrier line of the extreme
points of these maximal lines.
Continuing in a shape view, a maximal line in reductionx comprises one or more
lines from x that collectively form a single unbroken line segment. From the unreduced
lines comprising an arbitrary maximal line may be selected an ordered tuple of lines
such that each line in the tuple overlaps only its predecessor and successor lines in the
tuple. The entire tuple is ordered along the line of its equivalence class (for lines in
shapes, their carrier line). Its two endpoints are called start and end, where start  end
and  is according to the ordering of points on the carrier line. This tuple of lines is
said to span the maximal line and is called a spanning tuple. The lines not in this tuple
are called the nospans with respect to the spanning tuple. As Figure 10 shows, the
choice of the spanning tuple is not unique. To characterise a maximal line in in s^ we
need to know the start- and endpoints of a spanning tuple for the maximal line, the
order of the remaining points in the spanning tuple, and that the nospans are coincident
with the resulting maximal line. The nospans are otherwise irrelevanttheir exact
location on the line is immaterial.
Elements of v capture these choices. Each s^ 2 v c, ^ t^ represents a subpart
conguration comprising sets of instances from c^ and t^ that share a common,
coordinate-free representation, that is, the parameters of their start- and endpoints
points along their common carrier line.
Moving from a shape to a shape schema view of the problem transforms the above
steps. In a shape schema view, a particular s^ from v c, ^ t^ is gained by making the
following choices:
Step 1. Determine which line schemata from c^ will be embedded within which line
schemata from t^. This results in blocks of line schemata from c, ^ each of which will be
embedded within a corresponding block from t^.
Step 2. For each of the blocks from c^ above, determine an arrangement of maximal
lines to embed in the corresponding block from t^.
Step 3. For each of the blocks from t^ above, reduce to a constraint maximal single line
schema.
Step 4. Embed the maximal lines from Step 2 into those from Step 3.
In what follows, we describe a multifunction fx by a variable z that represents any
return value from fx. We write z fx to denote the more usual z 2 fx. This
permits composition of functions and multifunctions. For example, given function
g, z gfx denotes the result of applying g to an arbitrary one of the return
values of fx. The notation follows closely from logic programming syntax,
facilitating the task of relating this paper to the implementation of its algorithms.
We use the following notation for variable names. In fs Avp : f is part of the name of the
variable. It stands for the function(s) (or operation(s)), reading right to left, that have
been applied to the initial variable A; s is the scope of the variable, the object of which
168 R Woodbury

Figure 10. Line schema reduction is not unique. The set of line schemata in (i) can be reduced in different
ways, two of which are shown in (ii) and (iii). In (ii) the reduced line comprises ^j, ^l, m
^ and k^ in that order, each
constrained so that adjacent pairs overlap. Line schema n^ is constrained to lie anywhere on the result. In (iii) the
reduced line comprises ^j, n^ and k^ in that order, each constrained so that adjacent pairs overlap. Line schemata ^l
and m^ are constrained to lie anywhere on the result. Clearly, these are only two of many possibilities. For
instance, all the line schemata could be reoriented (start- and end-points exchanged) with each reorientation
combination yielding a new result.

it is a part; v is the version of the variable; p is a path that accesses a subpart of A.


Thus, gh 0 0
b Aij means the object g(h(b.A)) .i.j. A mnemomic form is:

functions version
scope Apath
Before going into detail, we abstract the process for the candidate as follows.
3 3 2 2
^ ! c B ! c L ! c M ! c m^ ! c L0 ! c B0 ! C
Oc

The abstract target process is more simple.


3 2
Ot^ ! t B ! t M ! t m^ ! t B0 ! T
An Introduction to Shape Schema Grammars 169

Figure 11. Step 1 in determining an s^ 2 v ^c, ^t: given p 2, group line schemata from c^ and ^t. Note that the
figure represents only one arbitrary choice of p and only one configuration that can result from this step.

In the above, a right arrow (!) signies an operation or sequence of operations. The
3
notation W ! X signies that the set W is composed of one or more X0 s (W must be
2
a set of sets). The notation Y ! Z means that Y is a member of Z. The specic
^ stands for candidate; the t^
variable names are mnemonic in the most part: the c^ in Oc
^
in Ot stands for target; B stands for Blocks from the candidate or target lines; L
stands for sets of coLinear Lines; M and m^ stand for a Maximal line; C stands for
Candidate; and T stands for Target. Variable names other than these are used in local,
specic situations.
Step 1. See Figure 11. Choose collections of line schemata from c^ and t^. Each collection from c^
will form a set of maximal lines that will be embedded in single maximal lines formed from the
collections from t^. Associate each collection from c^ with a collection from t^. Specically, take
the following steps starting with Step 1a.
170 R Woodbury

^ into a tuple
Step 1a. Partition Oc

cB ^
tupleOc
p 
of length p  Ot^ blocks. Each of the blocks in c B will form a set of maximal lines
that will be embedded in a single maximal line from t^. Since c B partitions Oc,
^ all lines
in c^ will be considered for the match.
Step 1b. Choose a subset

tB Ot^
q

of Ot^ of q elements such that q p. Only the elements of t B will participate in the
subpart relation.
Partition t B into a set

t B t B
p
of p blocks. Each block in t B will form a single maximal line that will receive a set of
maximal lines from a block from c B.
Permute t B into the tuple

tB 
t B
For a given value of p, any c B can be combined with any t B. That is, elements of the
Cartesian product of c B and t B now describe the line schemata from c^ that will be
embedded in reductions of line schemata from t^, but do not describe how these
embeddings will occur.
Step 2 deals with the individual blocks of lines partitioned above in Step 1a. Each c L 2 c B is a
collection of line schemata that will reduce to an ordered tuple of collinear maximal line
schemata. For each c L 2 c B create a corresponding c L0 by the following steps.
Step 2a. Divide each c L 2 c B into two sets c Ls and c Ln , where c Ls is a non null subset of c B and
c Ln c L  c Ls . Here s stands for spanning tuplethe lines in the s sets comprise possibly several
spanning maximal lines. In contrast, n stands for nospan, signifying that these lines will be
entirely embedded within maximal lines made from lines in s sets. See Figure 12. Line schemata
in the set c Ls will be combined into an ordered tuple of maximal lines, while those from c Ln will
be embedded within these maximal lines.
Step 2b. Partition c Ls into a collection c Ls of length l. See Figure 13.

c Ls c Ls
l

Each of the blocks c Ms 2 c Ls will act as a spanning tuple to form a single maximal line
and has length m.
For each c Ms there is a corresponding c Mn . Assign each line schema in c Ln to a
particular c Mn . Each such line schema will be embedded in a reduced line generated
from the chosen c Ms .
r
Step 2c. For each c Ms choose a right permutation c Ms r c Ms . This right permutation
establishes the order of the lines in the spanning tuple. See Figure 14. Clearly, when m 1, the
right permutation has no eect.
r r
Step 2d. Orient the line schemata in c Ms to produce  c Ms as follows:
 r
 r  c Ms l > 1, m > 1
c Ms r
c Ms otherwise
An Introduction to Shape Schema Grammars 171

Figure 12. Step 2a in determining an s^ 2 v ^c, ^t. Divide each c L 2 c B into two blocks c Ls and c Ln . In this and the
rest of the Rule 2 figures, the sizes of c Ls and c Ln are chosen to illustrate rule. They are not related to the figures
showing Rule 1. Throughout the Rule 2 figures, the names c^ x refer to the same (but possibly reoriented) line
schemata.

Figure 13. Step 2b in determining an s^ 2 v ^c, ^t. Partition c Ls into a collection c Ls of length l comprising blocks
c M. In this case l 2. For each c Ms create a corresponding set c Mn . Assign each element of c Ln to one of the sets
c Mn .

Figure 14. Step 2c in determining an s^ 2 v ^c, ^t. For each c Ms choose a right permutation to establish an
r
order c Ms of the line schemata in c Ms .
172 R Woodbury

r r
Figure 15. Step 2d in determining an s^ 2 v ^c, ^t. Orient the line schemata in each c Ms to produce  c Ms . If
r
there is only one c Ms in c Ls and it is itself a singleton, do nothing.

r
See Figure 15. Blocks c Ms for which the length of both c Ms and the enclosing c Ls is
one, that is, m 1 ^ l 1, need not be oriented as they stand by themselves for
maximal lines, the orientations of which are accounted for later.
r
Step 2e. See Figure 16. Generate from each of the  c Ms a maximal line schema m,
^ according
r
to the following (for readability in the following equations we write  c Ms as M):

m^ start M1start
m^ end Mmend
[
m
Em^ EM ^ j [
j1

Mkend Mk1 , k 1...m  1 [


Mkstart Mk1 , k 2...m [
Mkend m,^ k 1...m  1 [
^
 Mk1end , Mk1start , m, k 2...m  1

The eect of the above is that each pair of successive line schemata are constrained to
r
overlap; all of the line schemata in  c Ms are constrained to lie on m; ^ and the
endpoint of any line must not overlap the startpoint of the successor of its successor.
Embed the line schemata from c Mn into m: ^
[
^
Em ^ [
Ea
^ c Mn
a2

^
fa ^ a^ 2c Mn g [
mj
^
Em

Step 2f. See Figure 17. From the line schemata m^ in Step 2e, create the set c L0 fm^ j jj 2 lg of
line schemata. The line schemata composing c L0 will each be embedded in a line schema
generated from a corresponding element of t B.
Choose a right permutation of c L0
r 0
cL r c L0
This right permutation establishes the orientation in which the the maximal line
schemata in c L0 will be embedded in the maximal line schema computed from the
corresponding element of t B.
r 0
Step 2g. See
 Figure 17. Orient the line schemata in cL to produce c B0 as follows:
r
0  c L0 l>1
cB r
0
cL otherwise
An Introduction to Shape Schema Grammars 173

r
Figure 16. Step 2e in determining an s^ 2 v ^c, ^t. Form a single line schema from each  c Ms in the order and
orientation computed above and embed the corresponding c Mn in the line schema. For clarity we preserve
names in the form c^ x from previous figures.

Figure 17. Steps 2f and 2g in determining an s^ 2 v ^c, ^t. c L0 is a collection of collinear lines, each of which will
r
become a maximal line. c L0 is a unique ordering of the lines. c B0 orients these lines, each in one of their two
possible orientiations. The result will be embedded in the target.
r
Blocks c L0 for which l 1 need not be oriented as they stand by themselves for
maximal lines, the orientations of which are accounted for later.
0
The tuples of line schemata composing the tuple C hc Bi ji 2 pi will be embedded
as ordered and oriented into lines reduced from t B.
Step 3. Each t M 2 t B is a collection of length t m of line schemata that will be reduced to a
single maximal line schema m^ by using all of t M as a spanning tuple (for readability we omit the
index from t m and write, simply, m).
174 R Woodbury

r
Figure 18. Steps 3a, b & c in determining an s^ 2 v ^c, ^t. Each t M is ordered as tM and then the individual
r
schemata are oriented as  t M.

Step 3a. See Figure 18. Choose a right permutation


r
tM r t M
This right permutation establishes the order in which the the necessarily maximal line
schemata in t M will be combined to form a single constraint maximal line.
r  r
Step 3b. See Figure 18. Orient the line schemata in tM to produce tM as follows:
 r
 r  t M m>1
tM r
t M otherwise
r
Blocks t M for which m 1 need not be oriented as they stand by themselves for
maximal lines, the orientations of which are accounted for later.
An Introduction to Shape Schema Grammars 175

Figure 19. Step 3d in determining an s^ 2v ^c, ^t. Each target candidate t m


^ i has been reduced to a single line
schema, whereas the corresponding candidate Ci remains as a tuple of line schemata. The target can be oriented
in two possible ways to receive the candidate.

r
Step 3c. See Figure 18. Generate from each of the  t M a maximal line schema m, ^ according
r
to the following (for readability we write  t M as M and the length t m of t M as m):

m^ start M1start
m^ end Mlend
[
l
^
Em EMj [
j1

Mkend Mk1 , k 1...m  1 [


Mkstart Mk1 , k 2...m [
Mkend m,^ k 1...m  1 [
^
 Mk1end , Mk1start , m, k 2...m  1

All of the line schemata in tM are constrained to lie on m^ , each pair of successive line
schemata are constrained to overlap and the endpoint of any line must not overlap the
startpoint of the successor of its successor.
Step 3d. Orient each t m^ to produce t B0 t m.
^
The line schemata composing the tuple
T ht B0i ji 2 pi
will have the line schemata from C embedded in them.
Step 4. Identifying Ti with Ci, i 2 p gives the line schemata from c^ (whose elements have been
reduced to ordered tuples of oriented maximal line schemata) that will be embedded in
reductions of line schemata from t^ (some of whose elements have been reduced to maximal
line schemata), and describes how these embeddings will occur. It remains only to embed the
line schemata in each Ci in the line from the corresponding Ti.
176 R Woodbury

Create a subpart schema

z^ subparthhC, Ti, Ezi


^
The constraints Ez ^ must express how line schemata from each Ci are embedded into
the corresponding Ti. Recall that p is the number of maximal lines reduced from the
target that will participate in the match. Therefore jTj jCj p
Let t^i Ti2p , Ci Ci2p and li jCi j.

[
p [
li
^
Ez Cij t^i [
i1 j1

[
p l[
i 1

Cjend , Cj1start , t^
i1 j1

5 Shape Schema Arithmetic


The multifunction subpart v, the function difference () and the function plus ()
over shape schemata provide the machinery by which shape schemata are manipulated.
We rst dene the function difference  : b Ul X b
Ulm ! b
Ulm1 that produces a set of
line schemata from a line schema and a tuple of line schemata. Note in the equation
below the null constraint sets in the set of line schemata comprising the result. These
line schemata introduce no new constraints, so their constraint sets are empty.

^ hl^1 , . . . , l^m i flinehhk^start , l^1 i, i


k, start

linehhl^1 , l^i1 i, i, i 1, . . . , m  1


end start

linehhl^m1end , k^end i, i
g
The function difference  : b Um ! b Us creates from a given subpart schema z^ a shape
schema s^ representing the dierence between pairs t^i 2 z^T and Ci 2 z^C . Every line
schema in Ci must be removed from the line schema t^i , leaving behind a set of line
schemata. The constraint set E of the subpart relation carries all of the constraints of
the original shape, the rule and the matching process.

subparthhC, Ti, Ei shapehL, Ei


where
[
m
L t^i , Ci
i1
t^i 2 T, Ci 2 C

Us X b
The function : b Us ! b
Us is the schema produced by unioning Oa ^
^ and Ob,
  ^
^ and E b and taking the necessary reduction of the result.
unioning E a

^ nrshapehOa [ Ob, E a [ E bi
^ b
a,
An Introduction to Shape Schema Grammars 177

6 Shape Schema Rules


Recall the denition of a shape schema rule from Section 4.2.

rulehhl,^ r^i, Ei
where l^ (left hand side) and r^ (right hand side) are shape schemata and E is a set of
^ is the left hand side and rhsw
constraints. Further, recall that lhsw ^ is the right hand
side of a rule w. ^
Shape schema rules are matched to target shapes. The partial multifunction
match : bUs X b U ! ! b
Um produces a match schema recording how a rule w^ matches
to a shape s^.
^ matchhhz,
match^s, w ^ Ei, where
^ rhswi,
^ s^, and
z^ v lhsw,
^
E E^s [ Ew

A match of a shape schema rule can be applied to produce a result. The function
apply : b
Um ! bUs takes a match schema and returns a shape schema that is the
^ to the subpart schema
result of applying the matched rule right hand side rhsm
^
subpartm.
^ shapehL, Ei, where
applym
^ rhsm
L subpartm, ^ and
^
E Em

A shape schema rule r^ applies to a shape schema s^ when there is a match of r^ into s^, and
is applied when the resulting match schema is applied. More formally, if s^ and t^ are
shape schemata and t^ is the result of applying rule r^ to s^ then
t^ applymatch^s, r^

We write s^ ! t^ to denote the application of a rule r^ to derive t^ from s^.


r^

7 Shape schema grammars


Ui, j comprises a set of b
A shape schema grammar G in b Ui, j shape schema rules.

A derivation step of a shape schema grammar s^ ! t^ with respect to a given


G
shape schema s^ is a tuple h^s, t^i where s^ ! t^ for some r^ 2 G.
r^

A derivation sequence of length n of a shape schema grammar s^ ) t^ with respect to a


given shape schema s^1 is a tuple h^s1 , . . . , s^n i where s^1 ! . . . ! s^n G
G G

The sentential forms FG, i^ of a shape schema grammar G with respect to an initial
shape i^ comprise i^ plus the shape schemata at the end of all of the derivation sequences
of G with respect to i,^ or equivalently, the shape schemata reachable by zero or more
recursive application of the rules of the grammar to the initial shape.
[
^
FG, i^ fig ft^ji^) t^g
G
178 R Woodbury

The derivation space of a shape schema grammar G with respect to an initial shape i^
comprises the derivation relation of the grammar, that is, pairs of schema where the
second is derivable from the rst.
fh^s, t^ij^s ) t^ and s^ 2 FG, i^g
G
An equivalent denition is the transitive closure tc() of the individual derivation
steps
tcfh^s, t^ij^s ! t^ and s^ 2 FG, i^g
G
The language of a shape schema grammar with respect to an initial shape are those
sentential forms to which no more rules apply.
We omit both the usual terminal and non-terminal alphabet distinctions as well as
the initial shape in dening grammars. In the grammatical literature in general and in
the shape grammar literature in particular, labels from these alphabets are largely used
as a declarative control mechanism to determine which of the sentential forms of the
grammar are well-formed in some sense. The initial shape is used to encapsulate
together a grammar and its language. Our motivation is to allow grammar
composition and explicit control of execution. Other authors have taken similar
approaches. For example, Heissermans Boundary Solid Grammars (Heisserman,
1994) uses a state to determine when a grammatical process is complete. Carlson,
(1993) does away with all control mechanisms internal to a grammar and the
initial shape within a grammar itself, and provides an algebra for expressing
complex composition and control of grammars.

8 Implementation
The author implemented a shape schema grammar interpreter, rst in clp(R) (Jaar. and
Lassez, 1987), and then in Sicstus Prolog with constraint logic programming extensions.
A research assistant wrote a graphical interface in Java and JLog (Holst, 2014). Its
algorithms are navethey are very close to the mathematical specication above. The
reader might infer correctly that the matching displays exponential time complexity.
However, this is inherent in the problem itself: there can be exponentially many ways
that schema match, so an algorithm that nds all matches will itself be exponential. Thus
the algorithm is intractableit does not run in polynomial time with respect to its inputs.
The implementation is useful for matching small rules into small shape schemata (less
than about eight lines each). It suces for demonstrating matches such as those shown in
Figure 9, much in the spirit of Stinys numerous papers and book (Stiny, 2008).
At this point, the lack of apparent order relations over point, line and shape
schemata hinders progress towards an ecient implementation. I conjecture that no
such order relation exists and therefore that progress will be made by seeking
restrictions on generality that yield ecient match algorithms. For instance, limiting
or eliminating the reduction step in matching greatly reduces algorithm complexity.

9 Conclusion
In addition to dening a more general mechanism for parametric grammatical action,
shape schema grammars provide the rst general algorithm for parametric
grammatical action over shape-like objects. The fact of a general algorithm is the
An Introduction to Shape Schema Grammars 179

key research contributionthat it is intractable simply poses a new set of questions, in


both model and implementation.

Acknowledgements
I would like to acknowledge the support given by the Canadian NSERC Discovery Grants program, the
GRAND Network of Centres of Excellence, the Australian Research Council Small Grants Scheme,
Simon Fraser University, the Chair of Information Architecture at the Swiss Federal Institute of
Technology (Zurich) and The University of Adelaide. I would also like to thank Teng-Wen Chang and
Kewu Li for their work on an early, partial prototype of the implementation; Glendon Holst for porting
the code to Sicstus Prolog, and designing and implementing the Java/JLog interface; Karine Kozlova for
programming assistance; and Kellogg Booth and Sinisa Kolaric for edits and suggestions.

References
Akin O Z, Aygen T-W, Chang S-F, Chien B, Choi M, Donia S J, Fenves U, Flemming J H, Garrett N,
Gomez H, Kiliccote H, Rivard R, Sen J Snyder, Tsai W-J, Woodbury R, Zhang Y, 1997, SEED: A
Software Environment to support the Early phases of building Design. The International Journal of
Design Computing. Accessed on 28 Oct 2014 at http://pandora.nla.gov.au nph-wb/19990704130000/
http://www.arch.usyd.edu.au/kcdc journal/vol1/papers/emming/index.html
Carlson C, 1993, Grammatical Programming: An Algebraic Approach to the Description of Design Spaces.
PhD thesis, Department of Architecture, Carnegie-Mellon University.
Carpenter B, 1992, The Logic of Typed Feature Structures with applications to unication grammars, logic
programs and constraint resolution. Cambridge Tracts in Theoretical Computer Science. Cambridge
University Press.
Flemming U, 1987, More than the sum of parts: the grammar of Queen Anne houses Environment and
Planning B: Planning and Design 14 323350.
Flemming U, Woodbury R F, 1995, Software Environment to support Early phases in building Design
SEED: Overview ASCE Journal of Architectural Engineering 1(4) 147152.
Heisserman J, Woodbury R, 1993, Generating languages of solid models, in Proceedings of Second
ACM/IEEE Symposium on Solid Modeling and Applications pp 103112.
Heisserman J A, 1991, Generative Geometric Design and Boundary Solid Grammars PhD thesis,
Department of Architecture, Carnegie-Mellon University.
Heisserman J A, 1994, Generative geometric design IEEE Computer Graphics and Applications 14(2)
3745.
Holst G, 2014, JLOG/JScriptLogProlog in Java. Accessed on 3 April 2014 at http://sourceforge.net/
projects/jlogic/
Jaar J, Lassez J-L, 1987, Constraint logic programming, in Proceedings of the 14th ACM SIGACT-
SIGPLAN Symposium on Principles of Programming Languages, POPL 87, New York, NY, USA
pp 111119. ACM.
Krishnamurti R, 1980, The arithmetic of shapes Environment and Planning B: Planning and Design 7
463484.
Li K, Woodbury R, Radford A, 1998, A comparison of shape grammars, parametric shape grammars and
shape schema grammars in Proceedings of the Second International Conference on Mathematics and
Design Ed J Barrallo (San Sebastian, Spain) pp 2734 The University of the Basque Country.
McCormack J P, Cagan J, 2002, Supporting designers hierarchies through parametric shape
recognition Environment and Planning B: Planning and Design 29(6) 913931.
Muller P, Wonka P, Haegler S, Ulmer A, Gool L V, 2006, Procedural modeling of buildings ACM
Trans. Graph 25(3) 614623.
Stiny G, 1980, Introduction to shape and shape grammars Environment and Planning B: Planning and
Design 7(3) 343352.
Stiny G, 1991, The algebras of design Research in Engineering Design 2(3) 171181.
Stiny G, 2008, Shape: Talking About Seeing and Doing. The MIT Press.
Woodbury R F, 2002, A denition of shape schema grammars in Western Computer Graphics
Symposium, Vernon, BC, pp 103112.
180 R Woodbury

Appendix: An Explanation of Subpart Matching


The subpart match demonstrated in Figure 9 claims 1578 subpart matches for an
apparently simple target and candidate of three lines each. Further, the target is
constrained so that only one target conguration is possible. This appendix explains
how these matches occur. In Figure 9 either the candidates are matched into one, two
or three target lines, as shown in Figures 20, 21 and 22 respectively. Table 1 shows the
parameters for the identical process matching all of these into the target: rst, choose a
permutation of the candidates and assign each to a target; second, apply the candidates
thus assigned to the target in each of the two possible target orientations. Each of the
three cases yields its own number of candidate arrangements.
When there is only a single target line, all candidate lines must be embedded in it.
Figure 23 shows the six cases organizing the three candidates, while Table 2
enumerates these cases. The case of two target lines necessarily results in two
candidate lines going into one target and one line into the other. Three cases result,
as shown in Figure 24 with Table 3 enumerating these cases. For three target lines there
is but a single candidate arrangement: a tuple of three lines, as shown in Figure 20.

Figure 20. All three candidates are placed into a single target. This yields 135 possible candidate
arrangements.

Figure 21. With two target lines selected, the third will not receive a candidate. All of the candidate lines
must be distributed across these two targets. There are a total of 30 possible candidate arrangements.
An Introduction to Shape Schema Grammars 181

Figure 22. Three target lines. With only one possible target arrangement comprising the three lines of the
target, each line of the candidate must be allocated to a line of the target. This yields a single candidate
arrangement.

Figure 23. The six cases for one target line. All candidates must be placed in a single line, yielding six different
basic cases. The table enumerates the number of possibilities at each stage of generating the candidate (the
matches to the single target are given in Table 1). In all cases there is only a single member c L to consider: the
collection of all candidate lines that will go into one target line.
182 R Woodbury

Table 1. Column 1 (# of Targets) is the number of target lines for a particular match. All candidate lines will be
arranged into the same number of groups. In this example it can have values of only 1, 2 or 3, corresponding to
choosing a single line, two lines or three lines into which to embed subparts. Column 2 is the number of
candidate arrangements of the three candidate lines if they are (1) all grouped together into a single candidate,
(2) divided into two candidates or (3) divided into three candidates. Column 3 is the number of target
configurations. If there is only one target line, it can be any of the three lines. Two target lines leaves one line
unused and there are three ways of selecting that line. Three target lines can be chosen in only one way: by
choosing all lines. Column 4 is the number of permutations of candidates into targets. Column 5 shows the
number of ways that candidates can be embedded into targets by re-orienting the targets. There are 2n such
ways, where n is the number of target lines.

# Targets Candidates Targets Permutations Orientations Subtotal


1 135 3 1 2 810
2 30 3 2 4 720
3 1 1 6 8 48

Total 1578

Table 2. A single target line implies six cases distinguished by the number of spans (distinct lines) in the
candidate, and how lines overlap and are embedded in the spans.

Case 2a 2b 2b 2c 2d 2f 2g Subtotal
 r  r r 0  r 0
c Ls c Ls c Mn c Ms c Ms cL cL

(i) 3 1 1 1 1 1 1 3
(ii) 3 1 1 1 4 1 1 12
(iii) 3 2 2 1 1 1 4 24
(iv) 1 1 1 3 8 1 1 24
(v) 1 3 1 1 4 1 4 48
(vi) 1 1 1 1 1 3 8 24

Total 135

Table 3. With two target lines, the candidate must be partitioned into two and each partitition assigned to a
target. There are three ways of achieving such a partition. In case (i) the only additional choice is which line to
select for the sole span. In case (ii), the only choice is the orientations of the lines comprising the sole maximal
line that forms the candidate. In case (iii) the sole choice comes when the two maximal lines are oriented. Case
numbers refer to those in Figure 21.

Case 2a 2b 2b 2c 2d 2f 2g Subtotal
 r  r r 0  r 0
c Ls c Ls c Mn c Ms c Ms cL cL

(i) 3 1 2 1 1 1 1 6
(ii) 3 1 1 1 4 1 1 12
(iii) 3 1 1 1 1 1 4 12

Total 30
An Introduction to Shape Schema Grammars 183

Figure 24. The candidate cases for two target lines. One target must receive two lines and the other target a
single line.

SAGE Publications Ltd, 2015

S-ar putea să vă placă și