I want to find the Centroidal Voronoi Tessallation

1.2k views Asked by At

I want to find the Centroidal Voronoi but I have been confused . For instance lets say that I have two vectors

X=[1 2 1.1 1.3 1.4 1.5 1.3 1.2 1.8 2.1 2.2]; and 
Y=[1.5 1.3 1.5 1.8 1.4 1.6 2.5 2.3 2.4 1.1 1.8]; 

I use the command voronoi(X,Y) in order to have the diagram (see the attachment) . How can I have the Centroidal Voronoi tessellation according to Lloyd's algorithm ? I have found the Lloyd's algorithm in the internet :

while generating points xi not converged to centroids do
  Compute the Voronoi diagram of xi
  Compute the centroids Ci using equation (1)
  Move each generating point xi to its centroid Ci
end while

but I can't understand what I have to do in order to write the code and take the Centroidal Voronoi in matlab. Any ideas or alternatives please ?

1

There are 1 answers

0
edgarmtze On

Why not give it a try to CVT Centroidal Voronoi Tessellations

You can find source code and several examples, it has matlab, fortran and c++ source codes

This is from original source

CVT is a MATLAB library which creates Centroidal Voronoi Tessellation (CVT) datasets.

The generation of a CVT dataset is of necessity more complicated than for a quasirandom sequence. An iteration is involved, so there must be an initial assignment for the generators, and then a number of iterations. Moreover, in each iteration, estimates must be made of the volume and location of the Voronoi cells. This is typically done by Monte Carlo sampling. The accuracy of the resulting CVT depends in part on the number of sampling points and the number of iterations taken.

The library is mostly used to generate a dataset of points uniformly distributed in the unit hypersquare. However, a user may be interested in computations with other geometries or point densities. To do this, the user needs to replace the USER routine in the CVT library, and then specify the appropriate values init=3 and sample=3.

The USER routine returns a set of sample points from the region of interest. The default USER routine samples points uniformly from the unit circle. But other geometries are easy to set up. Changing the point density simply requires weighting the sampling in the region.