Geometry sangaku puzzle, incribed circle circle/triangle/square
Better answer.
$$q = 2 p \sqrt{2} \qquad\stackrel{p=3.06}{\to}\qquad q \approx 8.65$$
Previous answer.
$$q = 2 r - r \sqrt{2} = \sqrt{2}\left( \sqrt{2} r - r \right) = \sqrt{2}\cdot 2 p \quad\to\quad q = 2 p \sqrt{2} \quad\stackrel{p=3.06}{\to}\quad q \approx 8.65$$