slmsuite.holography.toolbox.lloyds_algorithm#
- lloyds_algorithm(grid, vectors, iterations=10, plot=False)[source]#
Implements Lloyd’s Algorithm on a set of seed
vectorsto promote even vector spacing. Vectors are bound within the grid.- Parameters:
grid ((array_like, array_like) OR
SLMOR (int, int)) – Extract the rectangular bounds from a grid, or from a shape. Seevoronoi_windows().vectors (array_like) – Initial seed points for Lloyd’s Algorithm. See
voronoi_windows().iterations (int) – Number of iterations to apply Lloyd’s Algorithm.
plot (bool) – Whether to plot each iteration of the algorithm.
- Returns:
The result of Lloyd’s Algorithm.
- Return type:
numpy.ndarray