I have an array of coordinates that combine to make a complex polygon.
This polygon essentially creates an area in my game, that could have any number of sides on it.
I would like to populate this area with monsters, randomly.
As such, I need to find a way to randomly generate coordinates INSIDE of this area/polygon.
My only idea right now to accomplish such a thing is to simply generate a random number until the number is inside the area/polygon... Although, at least to me, it seems like this method could be a little excessive... There must be some way to generate a point within a predefined area of coordinates...
Coordinate values are ALL signed integers.
Are there alternatives?
Aucun commentaire:
Enregistrer un commentaire