A New Generation of Computer Art

Some Examples from Graphica 2

Igor Bakshee

Introduction

A new and amazing instrument has come into the hands of artists. In the past, graphic art had to be painstakingly created from simple primitives such as lines, polygons or brushstrokes. But now, with Mathematica, an artist can think at a higher level—and at the click of a mouse can create complex objects all at once.

What makes this possible is the ability of Mathematica to describe processes as well as things. Instead of having to specify directly where each element in an image should go, an artist can think at the level of algorithms, specifying a process and then letting Mathematica form the final image.

The functional programming capabilities of Mathematica let artists easily build up complex algorithms from simple parts. Some of these parts are standard operations from mathematics. Others are simple operations on data. One of the crucial aspects of images that have the kind of charm one expects from human artists or from nature is that they have a certain degree of irregularity—sometimes quite obvious, sometimes very subtle. Mathematica makes it straightforward to add such natural touches by introducing certain forms of randomness.

This notebook shows an example of these ideas at work. Starting from a few small Mathematica functions it builds up images reminiscent of stone mosaics that few would imagine could be produced by  computer.

Carving the Stones

As with real mosaic, we first need to stock up on proper stones. This is done by creating function that carves away the sharp corners of a polyon.

Now we can actually run the function and see how it smooths a polyon.

Needs["Graphics`Colors`"]

poly  = 
       {{2,  8},  {4,  8},  {5,  7},  {4,  6},  {2,  7}};

Show[Graphics[{{Red, Polygon[poly]}, {Pink, Polygon[Carve[poly]]}}], 
      AspectRatio -> Automatic];

Setting up the Lattice

Having found a way to create individual stones, we now have to arrange the stones into a mosaic. We start by building a regular lattice; later we will see how to give it a more natural look.

Show[
      Graphics[Map[Line, Mosaic[Range, 0.6, {4, 4}], {2}], 
        AspectRatio -> Automatic]]

Adding Randomness

Show[
      Graphics[Raster[
          Normalize[CreateMatrix[Table[Random[], {#1}]&, {50, 150}]], 
          ColorFunction -> Hue]], AspectRatio -> Automatic]

Show[
      Graphics[Raster[Normalize[CreateMatrix[RandomWalk, {50, 150}]], 
          ColorFunction -> Hue]], AspectRatio -> Automatic]

Laying the Mosaic

Show[
      Graphics[{RGBColor[.9, .3, .6], AbsoluteThickness[3], 
          Map[Line, stones, {2}]}], PlotRange -> All, 
      AspectRatio -> Automatic]

Painting the Mosaic

Show[
      Graphics[{
          MapThread[List, {stonecolors, Map[Polygon, stones, {2}]}, 2], {
            Thickness[0.01], 
            MapThread[List, {edgecolors, Map[Line, stones, {2}]}, 2]}}], 
      PlotRange -> All, AspectRatio -> Automatic]

Ornamenting the Mosaic

Show[
      Graphics[{
          MapThread[
            List, {colors[[1]], 
              Map[Polygon, stones, {2}]}, 2], 
          MapThread[
            List, {colors[[2]], 
              Map[Polygon, shades, {2}]}, 2], {RGBColor[.9, .3, .6], 
            AbsoluteThickness[3], Map[Line, stones, {2}]}, {
            RGBColor[.9, .3, .6], AbsoluteThickness[1], 
            Map[Line, tinges, {2}]}}], PlotRange -> All, 
      AspectRatio -> Automatic]

About Graphica 2

Graphica 2 is a unique book of images generated with Mathematica by Igor Bakshee, and arranged by John Bonadies. For information about the book, visit www.graphica.com.