# Dynamic Step Distance Transforms

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

Contributed by: Richard Scott (March 2011)

Open content licensed under CC BY-NC-SA

## Snapshots

## Details

Several of the snapshots and bookmarks show approximately circular patterns. Other snapshots show snowflake-like shapes, rectangular or hexagonal, and patterns that operate on two scales, such as the "bow tie" example.

The statistics displayed under the images include two ways of measuring the circularity: the percentage variation in the radius and the number of sides of the polygon with the same radial variation.

The "symmetric" checkbox (checked) means that the initial cells are set to 1 (white) and surrounded by zeros (black). When unchecked, the right and diagonal lower-left values are also set to 1. Try making the bow tie or "least circular" bookmarks symmetric.

Internally the color is saved as the least significant bit of the distance, which is why the distance steps are even numbers.

The smaller neighbor counts image has a value at each cell in the range 0-8, equal to the number of neighbors with smaller distances. Closely spaced parallel white lines radiating outwards in this image are caused by distance contours with a fine sawtooth pattern, and always seem to indicate circularity generation or smoothing.

For example, the approximately circular rule 416 (Snapshot 2) with size set to the maximum (wait a few seconds) shows this, as does Snapshot 1. The most circular-appearing rule (20-sided polygon bookmark) shows a more uniform pattern; at large scale it can be seen to be a polygon without much smoothing. At a size of approximately 1000, the slight instability on the diagonals blows up and the circle grows four ears.

The rotationally symmetric rules are set up by taking the pattern of smaller neighbors as digits, cyclically rotating to a minimum position, then applying a rule to the first three or four color bits, taken in clockwise order from that position.

The hexagonal rules (rule type 6) use the two least significant bits for the color (black/white) and to simulate the hexagonal neighborhood by switching the six neighbors on alternate rows. Rule type 9, where the rule counts smaller neighbors (instead of smaller white neighbors), can achieve a similar effect. For example, try rule 348 with white distance steps (clockwise from top left) = {2, 2, 2, 100, 2, 2, 2, 100} and black distance steps={0, 198, 0, 0, 0, 198, 0, 0}.

Other growth rules (*A New Kind of Science*, p. 928) can be simulated by setting the black steps to a large value (or to 0, meaning ignore this neighbor), so that growth occurs first for smaller (white) steps.

The worm rules (rule type 7) turn left or right at each step depending on the color, producing tightly twisting or spiralling patterns with long path lengths. The path length is the longest series of decreasing distances back to the start.

With random selection of the color (rule type 8) it is interesting to vary the proportion of white/black and to compare the result with patterns generated by a color rule with the same percentage of white cells.

These dynamic step distance transforms can be defined more generally as cellular automata on directed acyclic networks on a grid. As with other kinds of distance transforms (fixed step or Euclidean), cells can be updated in parallel or sequentially in any order, with the same end result, although by updating in order of increasing distance, each cell need only be updated once.

They can be useful for image analysis and for modeling patterns where growth occurs along a front that sweeps across an area, leaving a fixed pattern behind. Examples include the time evolution of 1D cellular automata, and more general cases where the network connections and shape of the front are generated dynamically.

## Permanent Citation

"Dynamic Step Distance Transforms"

http://demonstrations.wolfram.com/DynamicStepDistanceTransforms/

Wolfram Demonstrations Project

Published: March 17 2011