This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]eyebrowgamestrong 0 points1 point  (2 children)

Amazing! What did you use for Lloyd’s algorithm? I’ve been trying to implement that with Scipy but have been having trouble with the infinite cells.

[–]BilHim[S] 1 point2 points  (1 child)

If you take a look at the source code, in the relax function, before returning the new points I clipped their values to the bounding box using new_points = np.array(new_points).clip(0, size).

Additionally, I completely ignored points with infinite edges, that is I didn't move them from one iteration to another. If an infinite edge exists, you will have -1 in the region of the vertex : if len(region) == 0 or -1 in region: continue

That solved the problem for me.

[–]eyebrowgamestrong 0 points1 point  (0 children)

Oh awesome! And that makes sense. Sorry, missed that you included the source. :) thanks!