Calculate max size of rectangle in pie chart I'm trying to get the maximum possible width and height of a rectangle inside a pie chart. All fields have the same angle. $\alpha$ is never bigger than $90^{\circ}$.
I have the variables $\alpha$, $r$, $b$ and I know that $w = 3h$. 
I'm searching for $w$, $h$ and $P_1 (x_1, y_1)$.
I'm a programmer, so I'm not that good with math and I have to translate this to Code afterwards. Thanks for your help!

Edit:
I'm using Javascript. Thanks to Paul. He explained me, that I have to use radians instead of degree using Math.tan. In addition, there is no Math.cot in Javascript. That's why I had to create two more functions.
const tan = (deg) => Math.tan(deg * Math.PI / 180);
const cot = (value) => 1 / tan(value);


Using the figure as our guide, and placing the origin at the center.
Your rectangle is symmetric about the line $x = 0$
It is bound on the upper-left corner by the line $y=x$
It is bound on the lower left corner by the circle $x^2 + y^2 = R^2$
Where $R$ is the radius of the circle that bounds the rectangle.
We can call these two coordinates $(x,x), (x,y)$
$x<0, y<0, |x|<|y|$
$H = x-y\\
W = -2x$
$W = 3H\\
-2x = 3x-3y\\
y = \frac 53 x$
$x^2 + (\frac 53 x)^2 = R^2\\
\frac {34}{9} x^2=  R^2\\
x = - \frac {3}{\sqrt {34}} R$
the 4 corners are:
$(- \frac {3}{\sqrt {34}} R, - \frac {3}{\sqrt {34}} R) , ( \frac {3}{\sqrt {34}} R, - \frac {3}{\sqrt {34}} R), (\frac {3}{\sqrt {34}} R,- \frac {5}{\sqrt {34}} R), (-\frac {3}{\sqrt {34}} R,- \frac {5}{\sqrt {34}} R)$
the area  $= \frac 43 x^2 = \frac {12}{34} r^2$
