dimanche 29 octobre 2017

Random point inside annulus with a shifted hole

First of all, will appreciate if someone will give me a proper term for "annulus with a shifted hole", see exactly what kind of shape I mean on a picture below.

Back to main question: I want to pick a random point in the orange area, uniform distribution is not required. For a case of a usual annulus I would've picked random point in (r:R) range and a random angle, then transform those to x,y and it's done. But for this unusual shape... is there even a "simple" formula for that, or should I approach it by doing some kind of polygonal approximation of a shape?

I'm interested in a general approach but will appreciate an example in python, javasctipt or any coding language of your choice.

shifted annulus




Aucun commentaire:

Enregistrer un commentaire