How to explicitly define the boundary of a neighbourhood of a given curve? Suppose $\varphi\colon[0,1]\to\mathbb R^2$ is a $C^1$ curve in two dimensions (not necessarily closed, nor simple). Consider the set 
$$ G_\epsilon(\varphi) = \{x\in\mathbb R^2 \mid \exists\,t\in\mathbb[0,1]: d(\varphi(t),x)\leqslant\epsilon\} = \bigcup_{t\in[0,1]} \bar B_\epsilon(\varphi(t)),$$
which generalises the idea of a disc (fixed distance from a point) by enclosing the curve with a uniformly wide strip. For example, the curve $\varphi\colon[0,1]\to\mathbb R^2$ below, given by $\varphi(t) = (-\sin\pi t, \cos (\pi t+3))$ is in orange, and its enclosing boundary set $G_{0.1}(\varphi)$ is in blue.

What I want to do is to give an explicit continuous function for the boundary $\partial G_\epsilon(\varphi)$ of such a set. I can manage to define the strips along the side of the curve, but not the $\epsilon$-semicircles at the end points. Suppose the boundary is given by $\psi\colon[0,1]\to\mathbb R^2$. Then what I have so far is the following:
$$\psi(t) = \begin{cases}
 \hfil ?\hfil & \text{if $0 \leqslant t \leqslant \frac{1}{4}$}\\
 \hfil \varphi(4t-1) + \epsilon\, \big(\begin{smallmatrix}0&1\\-1&0\end{smallmatrix}\big)\varphi'(4t-1)    & \text{if $\frac{1}{4} < t \leqslant \frac{1}{2}$}\\
   \hfil ? \hfil & \text{if $\frac{1}{2} < t \leqslant \frac{3}{4}$}\\
 \hfil \varphi(4t-3) - \epsilon\, \big(\begin{smallmatrix}0&1\\-1&0\end{smallmatrix}\big)\varphi'(4t-3)  & \text{if $\frac{3}{4} < t \leqslant 1$}
\end{cases}$$
The two cases I've defined comprise the parts of the boundary which are $\epsilon$ away from the curve along a vector perpendicular to the tangent vector $\varphi'(t)$. (It would be nice to find a simpler expression for these.)
I'm not managing to define the semicircles in general. I appreciate any assistance.
 A: I suspect you'll also want to normalize the tangent vector before rotating it, so that the width of the strip doesn't vary as the magnitude of the derivative changes. (I.e. replace $\phi'(x)$ with the $T(x)$ that I defined below.) Also there's going to be a bit of a problem if the derivative vanishes at some point along the curve.
As for the semicircles at the ends, there's actually an easy solution (again assuming the derivative doesn't vanish at the ends). Simply rotate the unit tangent vector around to trace out the semicircle.
Let $T(x) = \frac{\phi'(x)}{\|\phi'(x)\|}$. Let $$R(\theta) = \begin{pmatrix} \cos \theta & - \sin \theta \\ \sin\theta & \cos \theta \end{pmatrix}$$ be the rotation matrix.
Then the first segment of your curve should be $R(\pi/2 - 4\pi t)  T(0)$ ($\theta$ goes from $\pi/2$ to $-\pi/2$) and the third segment of your curve should be $R(-\pi/2 + \pi(4t-2)) T(1)$ ($\theta$ goes from $-\pi/2$ to $\pi/2$). 
I'm pretty sure these are the correct angles given how you've defined your curve.
