Marching Squares Algorithm

Dear Mr. Horton:

I am investigating options for creating 2D contour plots for the freely
distributable Matplotlib package (
The Matplotlib license requires all the software to be free for
noncommercial and commercial distribution.

I had the idea to try to implement marching squares for this package. We
know the marching cubes algorithm is patented, but what about the 2D
marching squares? Can my implementation be used in this freely
distributed package without obtaining a license grant?


      * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    * Curtis S. Cooper, Graduate Research Assistant *
   * Lunar and Planetary Laboratory, University of Arizona *
   * *
   * Kuiper Space Sciences, Rm. 318 *
    * 1629 E. University Blvd., *
     * Tucson, AZ 85721 * * * * * * * * * * * * * * *
      * Wk: (520) 621-1471 *
       * * * * * * * * * * * *

My system is set up so that when I am logged into root (via su) the root user
cannot access the X display. I like this behavior but it means that I cannot
install matplotlib as the root user (I can use sudo) because wants
to import pygtk and wxPython both of which try to connect to the X display.

It seems to me that it is unnecessary to connect to the display to compile the
matplotlib extensions, rather the import gtk command exists to test to see if
the pygtk package is installed. If I am wrong then this does not matter. I
thought that the build procedure would be more robust is it was not necessary
to import the whole pygtk and wxPython packages in order to test for their
presence. Is there a standard way to test for the presence of a package
without actually importing it? I know that I could temporarily export a
display for the root user - but I don't want to and I don't think it should
be necessary if it is not required.

I have been thinking about ways to test for packages without importing them.
Would it be possible to test for the offending packges by importing
subpackages that do not connect to the X server? For example in the case of
pygtk 'gobject' can be imported successfully when no X display is available.
(This works on my system because pygtk-2.0 is part of the python path - I did
not put it there so I assume that is standard - if not this procedure would
require that the appropriate directory was appended to then removed from the
python path.)

The disadvantages that I can see are that it would make the build procedure
dependant on the naming of subpackages within a package and it would not
actually check for a working installation just the presence of a certain
package. I guess it depends how great the demand is to be able to install
matplotlib from an environment that does not have a X display.