0
\$\begingroup\$

Following challenge: having any number of connected 2D faces forming virtually a polygone and filling the polygone with a variable number of points equally distanced to each other.

So here is a sample 2D object with any number of faces, all connected to each other, forming virtually a polygone:

enter image description here

Here is what I would like to calculate (in JavaScript or Python or pseudo): a variable number of points inside the faces, equally distanced to each other.

enter image description here

Some notes:

The points distance to each other doesn't need to be 100% the equal. Prioritized points are at the borders of the faces I should be able to define the targeted number of points, but it doesn't need to be exactly that number of points, can be more or less. Any ideas how to approach?

\$\endgroup\$
1
\$\begingroup\$

You probably want Lloyd's Algorithm. You'd confine the search space to the area contained within the original polygon, but would perform the iterations normally otherwise.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.