Mosaic hulls
As mentioned, mosaics can be illustrated simply by drawing the graphs
(Figs. 2A, B), with the addition of squares around the edges helping to
understand how the area calculation works (Figs. 2C, D). However, these
plots are not as intuitive as convex hulls, which are simple filled
polygons – and are misleading when shapes are actually convex, which is
routinely true of large, real-world data sets. Computing mosaic graphs
makes it possible to replace convex hulls with hulls that allow for
convexity. The procedure, which is used by the mhull function in
the mosaic package, starts by choosing the most extreme point in
one direction along one axis or the other, and by recording which point
is to the immediate left of this one. The rest of the algorithm is as
follows. Suppose that the last-visited point is A, the current point is
B, and B is connected by an edge to A, C, and D. (1) Points like C and
D, but not A, are examined. (2) The angles between B and neighbours like
C and D are computed. (3) The points are ordered relative to the angle
of a line going back from B to A, and the next one to the right (say C)
is selected. (4) Step 1 is revisited (so B is replaced with C). (5) The
algorithm terminates when the first point is reached again, but only on
the occasion that it is reached from the point to its left.