I have a project to calculate voronoi diagrams, I programmed the midpoint calculation part but it doesn’t gives one of the possible coordinates

  Kiến thức lập trình

I got a term project about calculating voronoi diagram of origin, and I programmed till the finding the midpoints part. Our professor sent a project example us to learn needed formulas. In this example, the voronoi cell has 2 corners. I wondered “Can I also generate midpoints for 3-corner voronoi diagram?”, and i runned my code for 5-6 times. I got numbers between 4 to 12, but not 3. Then I wrote a condition like “while 4<= len(midpoints), do your thing, and +1 the counter”. The counter is more than 10 million now and code still works. I wonder if there is a problem in code.

I tried to print out all calculations and checked them by doing them by hand. Seemed there is no problem.

Here is the GitHub link for code.

New contributor

Deniz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.