So basically I want to draw a random circle of radius R inside a bigger one, but the drawn circle should encompass a specific point.
If my math is right, it comes down to solving the following and getting the valid ranges of x and y:
x^2 + y^2 - xF - yG < H
, where F, G, H are known.
But there may be an easier approach. Any kind of help, even partial, is appreciated.
More info on how I got to the above equation, for those interested:
Given: Ca = bigger circle (Center=C0, Radius=R0), Cb = smaller circle (C1, R1) inside Ca, P = point to be contained by Cb;
Then: d(C1, P) < R1
and d(C1, C0) < R0 - R1
, where d(A, B)
is the distance between points A and B.
I've squared both sides of each of the inequalities (I'm allowed to because everything's positive) and then summed them together (left with left and right with right), and after some - hopefully correct - steps I got to that inequality.
Edit: Alright, I eventually solved the inequalities via the wolfram alpha website. It turned out solving for the range of x then sampling a random x from it works, but further solving for ranges of y from that point yields erroneous results. Either summing up these kinds of inequalities is not allowed, or another way of solving both x and y at once is needed. It's way over my math skills so I went with solution #1, which actually isn't that bad. I'm using a fallback method if the number of iterations is bigger than 50, just to keep it finite.