4.2 Compound Motif
A compound motif is a list of references to other
motifs and some flags to specify the semantics of
utilizing the list. Depending on the flags, compound
motif behaves as one of the following:
(i) Aggregate: Aggregate compound motif is just a
collection of motifs from the simple motif list. It
models itself by asking all its sub-motifs to
render themselves one by one.
(ii) Pattern: Pattern treats the motif list in a special
way. The first motif is treated as Base-Motif and
the rest as Repeat-Motifs. While modeling,
transformation list is requested from Base-Motif
and Repeat-Motifs are generated with one
Repeat-Motif per transformation. If the numbers
of transformations are more than the number of
Repeat-Motifs, the Repeat-Motifs are treated as a
circular list. For each transformation in the list,
the steps include (a) transformation of the current
coordinate system, (b) Selection of next Repeat-
Motif and its generation, and (c) Undoing the
transformation done to the coordinate system
5 PATTERN TREE
Motifs interact with each other forming a hierarchic
structure called pattern. To form a pattern, motifs are
declared. Some of them are simple and some are
compound. This leads to a hierarchy of motifs,
which can be represented as a pattern tree. The
internal nodes represent compound motifs and leaf
nodes represent simple motifs. Figure 2 shows two
samples of motifs and the resultant patterns.
Figure 2: Modeling of Motifs and Patterns.
6 IMPLEMENTATION
The pattern tree has been implemented using C++
language. The NURBS++ library is used for curve
manipulations. NURBS++ is a free C++
implementation of NURBS curve providing a vast
array of operations on the curve.
Adobe Post Script format is used for the output.
PostScript is a powerful page description language
that can be used to produce high quality printed
outputs. GUI is also provided for editing the pattern
tree. It uses GTK--, the C++ version of GTK, and
the GIMP tool kit, for the user interface elements
also known as widgets. GTK-- is chosen for its well-
defined API interface and ease of use.
6.1 Shape Description Format (SDF)
SDF is an ASCII file format that describes simple
motifs in terms of interpolated curves and compound
motifs in terms of simple motifs. Interpolated curves
were chosen since they can represent the common
primitives in floral patterns easily. Also the points
for interpolation can be determined easily by
drawing the primitives on a graph paper. Such
primitives include curved lines, petal outlines, leaf
outlines, etc. The SDF consists of:
Global Attributes and Parameters: This section
contains global attributes for rendering motifs. These
are used if the motifs themselves do not have their
own attributes. Also some transformations are
allowed to allow overall effects on the pattern, such
as adjusting its position on the output page, scaling
entire pattern, etc. Page size can also be specified.
Simple Motif Description: This consists of
geometric description of curves that make the motif.
The curve is specified by means of a list of points
lying on that curve. The points are interpolated as
and when needed to get a NURBS curve. The list of
transformation points can also be specified. Optional
attributes can be specified to alter line color, line
width and fill color of the motif.
Compound Motif Description: Compound
motifs are specified as lists of other motifs. Other
motifs are referred to by their motif_id which is
unique to every motif. Optional flags can be
specified to alter the behavior of the compound
motif as discussed in pattern model.
Render Requests: Render request is simply a
directive to the program to add the motif to a list of
motifs. The list is used for rendering when the
pattern tree is ready.
These entities can occur in any order in the file.
Motif
Pattern
Motif
Pattern
GRAPP 2007 - International Conference on Computer Graphics Theory and Applications
178