mardi 7 juillet 2015

How to generate a random point within a square but NOT within a circle cut out inside the square

Reference Image: http://ift.tt/1NPY6JT

The red circle has a radius of r

The blue square has a side length of s

The goal is to generate a random point within the blue zone but not in the red zone I already have a solution, but it involves trial and error and that is not my prefered method, is there some sort of mathematical solution to this problem?




Aucun commentaire:

Enregistrer un commentaire