This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Demos / Notebooks /

A New Generation of Computer Art

Some Examples from Graphica 2

Igor Bakshee


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.

This loads standard Mathematica color definitions.

This specifies the coordinates of the vertices of a polygon.

This compares the carved and raw stone.

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.

This creates a sample lattice.

Adding Randomness

Here is an image created by choosing the color of each pixel independently.

This generates a random walk.

Laying the Mosaic

This seeds Mathematica's random generator so our pictures can be reproduced.

This sets up a random arrangement of stones.

Here is a picture of the stones.

Painting the Mosaic

This sets up a function for assigning colors to graphical elements.

This sets up a list of colors for stones.

This sets up a list of colors for stones.

This uses the colors to make a picture of the mosaic.

Ornamenting the Mosaic

This takes a random subset of the edge of each stone, and carves it again.

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