Formula to calculate a length to a point on hypotenuse according to given angle I have a right triangle:


*

*Height: y (value over 0)

*Width: y (value over 0)

*Angle: α (degrees, value between 0-90)



I need to find out the formula to count the length of x.


Using picture above, if $AB=BC=y$ then using Pythagoras' formula $AC=y\sqrt2$ and $CD=y\sqrt2-x$. Hence, using sine rule on triangle $ABD$ we get
\begin{align}
\frac{x}{\sin\alpha}&=\frac{y}{\sin(135^\circ-\alpha)}\\
x&=\frac{y\sin\alpha}{\sin(135^\circ-\alpha)}
\end{align}
or using sine rule on triangle $BCD$ we get
\begin{align}
\frac{y\sqrt2-x}{\sin(90^\circ-\alpha)}&=\frac{y}{\sin(45^\circ+\alpha)}\\
y\sqrt2-x&=\frac{y\sin(90^\circ-\alpha)}{\sin(45^\circ+\alpha)}\\
x&=y\sqrt2-\frac{y\sin(90^\circ-\alpha)}{\sin(45^\circ+\alpha)}\\
&=y\sqrt2\left(1-\frac{\cos\alpha}{\sin\alpha+\cos\alpha}\right)\\
&=\frac{y\sqrt2\sin\alpha}{\sin\alpha+\cos\alpha}
\end{align}
