Each feature point has a unique ID number. Using the ID number of the closest feature point as the color value renders a mosaic of color areas. In this case the manhattan distance measure is used to determine which feature point is the closest.
cd = CellDataStruct(this, 1, at, cn.MANHATTAN);
...
cn.noise(cd);
pixels[x + y*width] = color(
(cd.ID[0] % 255),
(cd.ID[0] % 155),
(cd.ID[0] % 100)
);
The complete code is available here, along with most of the other examples in the gallery. To be able to run it in Processing, you'll have to download the CellNoise library from the download page.
|