dimanche 25 décembre 2022

Getting random Vector2 positions within a crescent area

I am struggling to find a way to get Random positions within a Crescent area. Calculating the crescent is well documented using the difference of two overlapping circles. But that calculates the surface area, which is not enough if I want to generate random positions in that area.

illustration

In this illustration we know both the center origin points and radii:

CenterPoint of CircleA ca=0,0 Radius of ca caRad = 100
CenterPoint of CircleB cb=9,0 Radius of cb cbRad = 85

knowing these values we could fill in all the variables on the illustration; A, B, D, E and F. Calculating the Crescent Area would be

π*(caRad²) - π*(cbRad²) = 2775π

And this is where I am stuck, I have all the information yet, don't know on how to proceed getting random positions 'Within' that crescent area.

Any help in this matter is very appreciated, Nick.




Aucun commentaire:

Enregistrer un commentaire