CVT_SIZE is a FORTRAN90 library which attempts to compute a (weighted) centroidal Voronoi tessellation (CVT) in which each cell has a desired prescribed size.
Normally, given arbitrary initial data and a constant density, the CVT would comprise cells of roughly equal area. This program modifies the CVT iteration, allowing the user to specify a relative cell size for each cell. Thus, if the region has area 100, and we make a tessellation of two cells, and we specify weights of 1 and 3, we would hope for the cells to be computed with areas of 25 and 75 units respectively.
Internally, the desired cell sizes are normalized, and then the appropriate root is taken to account for the dimensionality of the space. (In 2 space, you take the square root of the normalized cell size, for instance.) This gives you the weight to be assigned to a generator.
Then, when it is time to compute the distance for a sample point to the center of each Voronoi cell and take the "closest" one, we divide each cell's distance by the adjusted weight. This has the effect of making cells with a larger weight seem closer than they really are, and hence they attract more sample points, and end up with a larger area.
If only a small number of generators are used, or if the weights vary greatly in size, the effects of local geometry and curvature come into play, and the chosen weights produce areas that are only roughly what is desired. Increasing the number of cells being used seems to produce more regular behavior, with the cells tending to have the areas requested by the user.
Some of the activity on this project was inspired by a query from Professor Alexandru Telea, of the Department of Mathematics and Computer Science, Technische Universiteit Eindhoven.
Early versions of the code required the PS_WRITE library in order to create PostScript images of the CVT regions. These images were made by sampling the region, and drawing little circle of the color of the nearest generator. The resulting images were charming, but fuzzy, slow to render, and enormous in size.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
PBMLIB is a FORTRAN90 library which can create crisp and relatively small PPMB images of the CVT regions.
We were interested in watching the behavior of the Voronoi cells over "time". We set up a problem with 10 generators, with weights 1, 2, 3, ..., 10. We started with random initial locations for the generators, and carried out 100 iterations of the CVT code. We saved a PPMB file containing an image of each step, used the CJPEG program to convert these to JPEG files with consecutive file names, fed that into QuickTime Pro to create an animation, and saved the result as an MPEG-4 file.
Click HERE to see the CVT movie.
We ran the code on a variety of different sets of data.
We made a sequence of calculations giving half the cells weight 1 and half weight 4. Increasing the number of generators seemed to show regular behavior.
You can go up one level to the FORTRAN90 source codes.