Parametric curve of a spiral with straight and semicircular parts I need to design a fully parameterized spiral like this

where I can choose/change the central part length and the radius of the innermost curve.
I understand that it will be somehow related to the Archimedean spiral, whose equations are $x=r\cos(\theta)$ and $y=r\sin(\theta)$, but I can't pull this out.
Can anyone help me with this? Thanks in advance!
 A: Our aim is to find two curves $\mathbf l(t, k)$ and $\mathbf s(t, k)$ that depend on $t$ and an integer $k \geq 1$ such that $\mathbf l(t, k)$ gives the $k$th line segment in the curve and $\mathbf s(t, k)$ gives the $k$th semicircle in the curve. Henceforth, I will assume without loss of generality that this curve is symmetric about the $x$-axis.
Observe that we can parametrize each of the semicircles by $\mathbf s(t, k) = \langle C(k) + R(k) (-1)^{k + 1} \sin t, R(k) \cos t \rangle$ for $0 \leq t \leq \pi,$ where $C(k)$ is the $x$-coordinate of the center of the $k$th semicircle, and $R(k)$ is the radius of the $k$th semicircle. Each of these curves unravels clockwise from top to bottom for $k$ odd or bottom to top for $k$ even, as desired. Considering the diagram, we have that $\{C(k)\}_{k \geq 1} = \{5, -5, 5, -5, \dots \}$ so that $C(k) = (-1)^{k + 1} 5.$ Likewise, we have that $\{R(k)\}_{k \geq 1} = \{\frac 2 2, \frac 3 2, \frac 4 2, \frac 5 2, \dots\}$ so that $R(k) = \frac{k + 1}{2}.$ We conclude therefore that the parametrization of the $k$th semicircle of the curve is given by $$\mathbf s(t, k) = \biggl \langle (-1)^{k + 1} \biggl( 5 + \frac{k + 1}{2} \sin t \biggr), \frac{k + 1}{2} \cos t \biggr \rangle \text{ for } 0 \leq t \leq \pi.$$
Observe that the sequence of $y$-coordinates for the line segments is $\{1, -1, 2, -2, 3, -3, \dots\}.$ Consequently, the $y$-coordinate for the line segments is controlled by the equation $y(k) = (-1)^{k + 1} \lfloor \frac{k + 1}{2} \rfloor,$ where $\lfloor \cdot \rfloor$ denotes the usual floor function. Each of the line segments has length 10 (except for the first one) and has endpoints $(-5, y(k))$ and $(5, y(k)),$ so we have that $x(k) = (-1)^{k + 1} \bigl(\frac{10}{\pi} t - 5 \bigr).$ (We need to divide by $\pi$ because we assume in the parametrization of the semicircles that $0 \leq t \leq \pi.$) Consequently, we obtain $$\mathbf l(t, k) = \begin{cases} \bigl \langle (-1)^{k + 1} \bigl(\frac{10}{\pi} t - 5 \bigr), (-1)^{k + 1} \bigl \lfloor \frac{k + 1}{2} \bigr \rfloor \bigr \rangle \text{ for } \frac{\pi}{2} \leq t \leq \pi & \text{if } k = 1 \text{ and} \\ \\ \bigl \langle (-1)^{k + 1} \bigl(\frac{10}{\pi} t - 5 \bigr), (-1)^{k + 1} \bigl \lfloor \frac{k + 1}{2} \bigr \rfloor \bigr \rangle \text{ for } 0 \leq t \leq \pi & \text{if } k \geq 2. \end{cases}$$
