I have a circle with center (0,0) and radius 1. I have calculated a random point inside a circle by generating a random angle $a=random()\cdot 2\pi $ and a random distance smaller than or equal to the radius $b=random()\cdot r$. The center of the line is $(cos(a)\cdot b,sin(a)\cdot b)$. The line has to be inside the circle like this:
Knowing this information how can I calculate the equation of the line in the most efficient way for a computer? Thanks.
The random function generates a random Real Number between 0 and 1.
Best Answer
In polar coordinates,
$$\rho\cos(\theta-a)=b,$$
hence $$x\cos a+y\sin a=b.$$