Computational Aesthetics 2011

Two large format digital prints by Paul Hertz will be shown in the juried art show at the annual Computational Aesthetics conference, held this year in Vancouver, Canada from August 5 through 7. The archival inkjet prints from the artist’s recent “Sampling Patterns” series, Ponente and Shimmer, were printed at Ignotus Editions.

Selections from the Sampling Patterns series can be viewed here, in a Flickr set. The series was developed with the Processing programming language, including Hertz’s Processing Library, IgnoCodeLib.

Artist’s Statement

Ponente and Shimmer are based on regular random distributions known as “blue noise.” Natural phenomena such as identically charged particles jostling for position within a limiting boundary or a flock of birds adjusting their mutual distances have similar distributions. Blue noise dot patterns have interesting visual and cognitive effects: Their regularity seems to imply an order just about to emerge, which their randomness negates. These and other works in my “Sampling Patterns” series are snapshots from interactive real-time animations where the geometric points of the distribution are used to sample functions that control color, scale, shape, and other visual attributes. The snapshots are further edited to produce prints.

In Ponente, blue noise grids determine the locations of distorted circular shapes in different scales and granularities. Low frequency wave functions control variations in scale and simple coloring rules distinguish different layers of shapes or populations within each layer. In Shimmer, a distribution is partitioned into three populations that are distinguished by algorithmically determined colors. Each population has its own shape-generation rule. A global rule for shape orientation (a wave function) creates swirling motions over the visual field.

MySQL-Python on MacOSX 10.6 Snow Leopard

GCC was reporting a file not found error for stdarg.h early in the compile of MySQL-Python-1.2.3 on MacOSX 10.6 (Snow Leopard). I was staring right at the file, “/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h,” so it most certainly did exist. The problem seems to have been caused by the GCC compiler version and architecture I was using with my Python, Apache and MySQL installations.

$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
$ mysql --version
mysql Ver 14.14 Distrib 5.1.35, for apple-darwin9.5.0 (i386) using readline 5.1
$ /usr/sbin/httpd -v
Server version: Apache/2.2.17 (Unix)
$ python --version
Python 2.6.2

This was not obvious until I went to the trouble of downloading the MacOSX10.4u.sdk files and still had the same error—but I will spare you the tale of the hours I lost banging my head.

For reasons that don’t matter here, I had previously manually compiled both Apache and MySQL to use 32-bit architecture. As I understand from all the help I looked for online (this site where my issue with stdarg.h was part of the discussion was particularly helpful), all the various libraries, Python, and the GCC compiler need to be using the same architecture. I found two solutions:

MySQL-python-1.2.3 $ sudo CC=/usr/bin/gcc-4.0 python setup.py clean
MySQL-python-1.2.3 $ sudo CC=/usr/bin/gcc-4.0 python setup.py build
MySQL-python-1.2.3 $ sudo CC=/usr/bin/gcc-4.0 python setup.py install
MySQL-python-1.2.3 $ sudo ARCHFLAGS='-arch x86' python setup.py clean
MySQL-python-1.2.3 $ sudo ARCHFLAGS='-arch x86' python setup.py build
MySQL-python-1.2.3 $ sudo ARCHFLAGS='-arch x86' python setup.py install

Everything compiled with either one of these. The latter seems to me to be the better solution. After running it, I could load the library in Python with no errors:

>>> import MySQLdb

I was then able to get Django to talk with MySQL and set up a database. Yay!

Notes: For the compile to work you will also need the Python setuptools module. I installed it using easy_install, which I had evidently installed without installing the full setuptools package.

Django, PYTHONPATH, and iPython

After trying Drupal and finding it needlessly twisted, I have decided to experiment with Django. I’m working my way through Python Web Development with Django®, by Jeff Forcier, Paul Bissex and Wesley Chun, published by Addison-Wesley Professional in 2008. Thing have gone smoothly, so far, though I have not yet set up Apache to work with Python and Django either locally or on my server. My previous experience has been limited using Python for cgi scripting.

I followed the Django installation instructions at http://docs.djangoproject.com/ to install Django 1.2.5 (current version is 1.3), generally without a hitch. Following instructions in Appendix B of the book, I ran the command python setup.py install from the Django directory. Also at the suggestion of the book, I installed iPython. It has some handy features, but also seems to have far more features than I need. I’ve also had a problem with its recognizing my Django directory as part of its search path. The regular Python editor does not have this problem.

To inspect the search path, start python:

$ python
Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path

This should print out a mutable list of paths. The problem is, the list is different if you invoke ipython as the editor. In fact, it’s missing the path that contains the Django library. As a result typing

>>> import django

in iPython will return an error message. It works just fine in the regular old Python editor.

The remedy? For scripts that are run from the Terminal, you need to create or modify the PYTHONPATH environmental variable, which stores the search path returned by sys.path in Python. Even if you haven’t set this variable, the standard Python editor apparently gets all the necessary information from other path variables in Mac OSX, while iPython doesn’t. It seems to be missing one specific path. To add it in, edit your ~/.bash_profile file to contain the following line:

export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages:$PYTHONPATH

You can add other paths to this later on, as you develop your own modules. Other techniques for adding to the search path involve .pth files or, for apps launched from the finder, creating or modifying ~/.MacOSX/environment.plist.

Surprised Party

A new Voronoi-based computer print by Paul Hertz, Surprised Party. Paul suggests that this print registers his giddy mood upon being welcomed to a surprise birthday party, a plot hatched by his wife, sister, and son and very successfully executed. The party was surprised.

Surprised Party

Surprised Party

The image was generated with multiple passes of Michael Balzer’s code for Capacity-Constrained Voronoi Tesselations. Basically, the CCVT algorithm generates random dot patterns where the dots are evenly distributed. The CCVT algorithm has the particularity of greatly reducing geometric artifacts, such as hexagonal grids,  that may appear in other generation methods. The artifacts can easily be detected just by looking, from which one might deduce that the human visual system is very good at detecting order within randomness.

Detail of Surprised Party

Detail of Surprised Party

Like a perfect gray tone, CCVT-generated dot patterns seem to have a aesthetic appeal that has a statistical correlate. Using them to produce art seems rather natural, in the tradition of “all-over” abstract painting. Their lack of order has the somewhat paradoxical effect of enabling one to see all sorts of orders–trails and swirls of dots where the fundamental rules are, roughly, for dots to keep their distance and avoid regimentation.

The Fibonacci Series and some shuffling were instrumental in selecting and assigning the colors. I leave it to the curious to decipher the numerical game. It should not be difficult. Like a good friend, you can count on the Fibonacci series.

/**
* Shuffles an array of integers into random order
* @param intArray   an array of ints
*/
public void shuffle(int[] intArray) {
  for (int lastPlace = intArray.length - 1; lastPlace > 0; lastPlace--) {
    // Choose a random location from 0..lastPlace
    int randLoc = (int)( randGenerator().nextInt(lastPlace + 1) );
    // Swap items in locations randLoc and lastPlace
    int temp = intArray[randLoc];
    intArray[randLoc] = intArray[lastPlace];
    intArray[lastPlace] = temp;
  }
}

Bitmap to Surface to Model

Bitmaps can be used as height fields for a 3D terrain. Typically, the brighter the pixel value, the higher the terrain at the location mapped to the pixel. A 3D grid such as a terrain model can be output as cross-sections and created in any convenient material. The Processing app included with this post will do the whole process for you: open a bitmap, display it as a terrain model, and output cross-section profiles to a PDF file. The profiles include slot marks. Once you cut out the profiles and the slots, you can fit everything together into a model. The model can be used to construct a mold for the surface.

Let me explain this with pictures. First, here’s what the assembled model looks like:

The assembled model

The assembled model

Continue reading ‘Bitmap to Surface to Model’

Bezier Circle

Approximate a circle with cubic Bezier curves: here’s a simple method, written in Processing. The key to approximating the circle is a constant, kappa, that will help us calculate the distance from a Bezier anchor point on the circle to its associated control point, off the circle. Kappa is the distance between the anchor point and the control point divided by the circle radius, when the circle is divided into 4 sectors of 90 degrees. See these notes by G. Adam Stanislav for the math.

Circle approximated by five Bezier curves. Click to view applet.

Notes: Kappa is scaled by the number of sectors into which the circle is divided (k = 4 * kappa / sectors). Four sectors is the minimum required to get a good approximation. With a little bit of work it should be possible to create a circle with unequal sectors, scaling kappa by the portion of the circle occupied by each sector. From there, one could make various sorts of blobs by scaling the the control points and anchor points around the center of the original circle.

Fresnel Ring Moires

This Processing applet shows how overlapping Fresnel rings create moiré patterns that are either straight lines or Fresnel rings. The animation moves the two Fresnel rings together and apart at a constant rate, but the moiré patterns accelerate and decelerate. Animation works best when your browser isn’t doing a lot of other tasks that interrupt the applet–download it for best results.



Click in the applet and type “m” to use the mouse to drag the rings left and right. Type “a” to animate again. Source Code: moire. Made with Processing.

The Fresnel rings are drawn with circles using different stroke widths and no fill. The stroke widths derived by subtracting the diameters of a series of circles proportional to successive square roots of a sequence of integers 1..N.

  for (int i = 0; i < rings; i++) {
    diameters[i] = (float) Math.sqrt(i + 1) * max_diameter;
  }

Fresnel lenses are composed of prisms arrayed in Fresnel rings. In the 50s, plastic lens that you could slap onto your teevee to magnify the picture were popular. Large ones are used in solar cookers. The advantage over regular lenses is that Fresnels can be much lighter. They can also be built of modules that fit into a frame--this made them very efficient for focusing lighthouse lights, as they could be transported in sections and assembled on site.

Incidentally, putting a Java applet (from Processing) into a WordPress post was not simple. Following advice in the Processing forum, I resorted to the (deprecated) <applet> tag instead of using the markup generated by Processing. If anyone knows how to use that more current markup (or something similar), please post a comment. I had to do my final edits in the HTML editor and insert the <applet> tag with no linebreaks. Do not go back the visual editor if you do this--it will clobber the applet markup (you could probably fine tune MCEdit to get around this).

You can see this applet its own page, generated by Processing, here.

Feed Your Home Page

With the help of Magpie, feed2js, and jQuery I added feeds of my blogs to my home page at ignotus.com. I wanted a solution that would let me tailor HTML markup and CSS styles to my liking. I discovered quite a few services that will aggregate feeds for you and then let you install a widget within a page, some of them apparently quite useful–as this post at Wild Apricot Blog explains. However, I really didn’t want to depend on another site and I initially only needed to post my own, local blog feeds to my home page. Drupal can handle feeds, of course, but I wasn’t enthusiastic about swapping Drupal in for my home page. Powerful though Drupal is, it is far from transparent, especially if you want to port a pre-existing design of your own into Drupal. WordPress blogs that I had already started provided more tools for customization and page creation than Drupal blogging offers. No jQuery widget that I looked at quite fit the bill either. I settled on feed2js because I could completely tailor the processing of a feed and its HTML output with some PHP and jQuery coding to get it massaged into shape. The fact that it was written by someone I knew and whose code I trusted was a clincher.
Continue reading ‘Feed Your Home Page’

IgnoFactory Arrives

IgnoFactory, a blog at paulhertz.net, covers technical topics in digital art, including printing and image processing techniques, code, design, etc. It includes pages on Ignotus Editions, a fine art printing service, and on the artists of the ignoStudio.

For the curious, there are other blogs at ignotus.com. Mnemonic Spumoni deals with the lives, times, memories, work and opinions of the four artists represented at paulhertz.net (Paul Hertz, J.T. Pescador, Alma de la Serra and Darrell Luce). It\’s our social blog. Intermedia Patterns is a scholarly research project Paul Hertz and Jack Ox have been working on, pooling their ideas about intermedia art. There a various projects linked to our home page, too.