# VORONOI_PLOT Plot Voronoi Neighborhoods

VORONOI_PLOT is a Python program which plots the Voronoi neighborhoods of a set of center points.

The picture is created using discrete pixel geometry, rather than sophisticated analysis. In other words, each center point is assigned a color at random. Then each pixel in the image is colored the same as the nearest center point.

The program allows the user to choose the values of M and N, the number of rows and columns used in the pixel array.

The program allows the user to choose the LP norm in which distances are calculated, with P any positive real value. In particular

• 1: distance = sum of absolute values of differences;
• 2: distance = square root of sum of squares of differences (the Euclidean norm);
• P: distance = P-th root of sum of absolute values of P-th powers of differences;
• float('inf'): distance = maximum of absolute values of differences;

The scipy.spatial.Voronoi() and voronoi_plot_2d() commands can together create and plot a Voronoi diagram when the Euclidean norm is used to measure distance, but they do not have the ability to deal with other norms. This program gives a simple way of viewing such cases.

### Usage:

voronoi_plot ( xy, m, n, p )
where
• xy is the (2,NC) array of center points.
• m is the number of rows in the pixel image;
• n is the number of columns in the pixel image;
• p chooses the P-norm (1, 2,float('inf'), or some positive real value).

### Languages:

VORONOI_PLOT is available in a FORTRAN90 version and a MATLAB version and a Python version.

### Related Data and Programs:

DELAUNAY, a Python program which demonstrates the use of the scipy.spatial function Delaunay(), to compute a Voronoi diagram, and matplotlib.pyplot.triplot(), to display it.

VORONOI, a Python program which demonstrates the use of the scipy.spatial function Voronoi(), to compute a Voronoi diagram, and voronoi_plot_2d(), to display it.

### Reference:

1. Franz Aurenhammer,
Voronoi diagrams - a study of a fundamental geometric data structure,
ACM Computing Surveys,
Volume 23, Number 3, pages 345-405, September 1991.
2. Herbert Edelsbrunner,
Geometry and Topology for Mesh Generation,
Cambridge, 2001,
QA377.E36,
ISBN 0-521-79309-2.
3. Joseph O'Rourke,
Computational Geometry,
Cambridge University Press,
Second Edition, 1998,
QA448.D38.

### Source Code:

You can go up one level to the Python source codes.

Last revised on 16 October 2016.