lloydsAlgorithm(Px,​Py, crs, numIterations, showPlot)

Starts with a point set, repeatedly moves each point to centroid of Voronoi cell.
다운로드 수: 2.3K
업데이트 날짜: 2015/2/11

라이선스 보기

LLOYDSALGORITHM 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.
Inspired by http://www.mathworks.com/matlabcentral/fileexchange/34428-voronoilimit
Requires the Polybool function of the mapping toolbox to run.
Run with no input to see example. To initialize a square with 50 robots
in left middle, run:
lloydsAlgorithm(0.01*rand(50,1),zeros(50,1)+1/2, [0,0;0,1;1,1;1,0], 200, true)

인용 양식

Aaron T. Becker's Robot Swarm Lab (2024). lloydsAlgorithm(Px,Py, crs, numIterations, showPlot) (https://www.mathworks.com/matlabcentral/fileexchange/41507-lloydsalgorithm-px-py-crs-numiterations-showplot), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2012a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Voronoi Diagram에 대해 자세히 알아보기
도움

도움 받은 파일: VoronoiLimit(varargin)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.6.0.0

corrected error about some vertices not being in clockwise error by sorting the vertices

1.5.0.0

Corrected error when called as a function by adding a calculation for n, removed warning about order of vertices by sorting them in CW order, added example call as a function. Thanks for the feedback Kirill Smirnov!

1.3.0.0

When run with no arguments, starts the robots in a small grid pattern.

1.1.0.0

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.

1.0.0.0