mardi 1 décembre 2020

Is there an algorithm for random generation of circles in 2D?

Hi I am currently working on a space game in C++ with SFML. I have a 2D Vector which is my map. I want to create a random map where there will be randomly positioned and sized Planets in the map [As in example below.].

Planets shouldn't be touching or shouldn't overlap each other.

Right now idea is that I have a Class Planet that contains its center size_t i, j; and radius unsigned short r; and I want to create such random generator of pairs (point in 2D - center and radius of the planet). Either that or if there is completely different approach for this kind of problem I would be happy to hear it.

What I want to acomplish.

Note - there can be random number or planets. Doesn't matter if the map is packed or half empty.

This [↓] two touches sholdn't occur.

What I 100% don't want.




Aucun commentaire:

Enregistrer un commentaire