In general, the specification of the spatial composition rules is an important step in the design of visual systems, since a formal characterization of its structural characteristics is crucial to provide a systematic base and avoid ad-hoc implementations. Basically, there are two modalities used for composition, i.e. by connecting or spatially arranging graphical objects. In our work, we restricted our attention to the latter case and use a formal framework based on the box spatial relations as defined in G. Costagliola, A. De Lucia, S. Orefice, and G. Polese, A classification framework to support the design of visual languages, Journal of Visual Languages and Computing, vol. 13, no. 6, pp. 573-600.

In this framework the graphical objects are characterized by their bounding boxes, i.e., they can be syntactically described and manipulated through their bounding box, whatever the shape of the object is. Indeed, the spatial compositions that relate the graphical objects are defined on the coordinates of the upper-left and lower-right points of their bounding box.

The following definition gives a formal specification for the generic spatial relation REL with respect to a graphical object a. It uses two functions ULREL(m, n, m1, n1) and LRREL(m, n, m1, n1) that map the coordinates of the upper-left (m, n) and lower-right (m1, n1) points of the bounding box of a onto sets of points.

Example of spatial relation

Given a graphical object a with coordinates of the upper-left and lower-right points (x, y) and (x1, y1), respectively, and a graphical object b with coordinates of the upper-left and lower-right points (h, k) and (h1, k1), respectively, then: a REL b holds if and only if (h, k) is in the set ULREL(x, y, x1, y1) and (h1, k1) is in the set LRREL(x, y, x1, y1).

In other words, a REL b holds if and only if the upper left and the lower right points of b are contained respectively within two areas calculated on the syntactic attributes of a through the functions ULREL and LRREL.

The above definition of composition yields three types of possible spatial arrangements: inclusion, intersection and spatial concatenation, where the term "concatenation" refers to any spatial arrangement of graphical objects not intersecting their areas.

As an example, the relations INCLUDE, UP, DOWN, LEFT and RIGHT are defined as foloows. These relations model the general types of inclusion and spatial concatenation.

  • INCLUDE: ULINCLUDE(x, y, x1, y1) = {(m, n) | x <= m < x1, y1 < n <= y}, LRINCLUDE(x, y, x1, y1) ={(m, n) | x < m <= x1, y1 <= n < y}
  • UP: LRUP(x, y, x1, y1) = {(m, n) | n > y}
  • DOWN: ULDOWN(x, y, x1, y1) = {(m, n) | n < y1}
  • LEFT: LRLEFT(x, y, x1, y1) = {(m, n) | m < x}
  • RIGHT: ULRIGHT(x, y, x1, y1) = {(m, n) | m > x1}