Find the length x such that the two distances in the triangle are the same I have been working on the following problem
Statement

Assume you have a right angle triangle $\Delta ABC$ with cateti $a$, $b$ and hypotenuse $c = \sqrt{a^2 + b^2}$. Find or construct a point $D$ on the hypothenuse such that the distance $|CD| = |DE|$, where $E$ is positioned on $AB$ in such a way that $DE\parallel BC$ ($DE$ is parallel to $BC$).


Background
My background for wanting such a distance is that I want to create a semicircle from C onto the line $AB$. This can be made clearer in the image below

To be able to make sure the angles is right, I needed the red and blue line to be of same length. This lead to this problem
Solution
Using similar triangles one arrives at the three equations
$$
\begin{align*}
\frac{\color{blue}{\text{blue}}}{a - x} & = \frac{b}{a} \\
\frac{\color{red}{\text{red}}}{x} & = \frac{c}{a} \\
\color{red}{\text{red}} & = \color{blue}{\text{blue}}
\end{align*}
$$
Where one easily can solve for $\color{blue}{\text{blue}}$, $\color{red}{\text{red}}$, $x$.
Question
I feel my solution is quite barbaric and I feel that there is a better way to solve this problem. Is there another shorter, better, more intuitive solution. Or perhaps there exists a a way to construct the point $D$ in a simpler matter?

Not sure if this is less barbaric but using simple trig: $DE=(a-x)\tan A$, $DC=\frac{x}{\cos A}$ so the equation to solve is $$(a-x)\frac{b}{a}=\frac{x\sqrt{a^2+b^2}}{a}$$ or $$x=\frac{ab}{\sqrt{a^2+b^2}+b}$$
Just another idea to construct point $E$: since $\triangle{DCE}$ is isosceles, it's easy to find $\angle{ACE}=(90°-A)/2$
