Lloyd's Algorithm
by Aaron Becker
26 Apr 2013
(Updated 29 Apr 2013)
Starts with a point set, repeatedly moves each point to centroid of Voronoi cell.
|
Watch this File
|
| File Information |
| Description |
Runs Lloyd's algorithm on the particles at xy positions (Px,Py) within the boundary polygon crs for numIterations iterations.
showPlot = true will display the results graphically.
Lloyd's algorithm starts with an initial distribution of samples or points and consists of repeatedly executing one relaxation step:
1. The Voronoi diagram of all the points is computed.
2. Each cell of the Voronoi diagram is integrated and the centroid is computed.
3. Each point is then moved to the centroid of its Voronoi cell.
Run with no input to see example.
Uses http://www.mathworks.com/matlabcentral/fileexchange/34428-voronoilimit,
which requires the Polybool function of the mapping toolbox to run. |
| Acknowledgements |
Voronoi Limit
inspired this file.
|
| Required Products |
Mapping Toolbox
MATLAB
|
| MATLAB release |
MATLAB 7.14 (R2012a)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 29 Apr 2013 |
removed dependency on www.mathworks.com/matlabcentral/fileexchange/34428 (which sometimes miscalculates the Voronoi cell boundaries), robots never leave the boundary, reduces to a single file. |
| 29 Apr 2013 |
When run with no arguments, starts the robots in a small grid pattern. |
|
Contact us