# Offsetting a curve in 2D

I'd like to "move" a curve $d$ (offset) units "up" (actually in the sense that the perpendicular distance between the curves is always constant). The objective is to create a channel that has constant width. I want the shape of the second curve such that the shortest distance to the first curve is the same everywhere. Here's a picture to better illustrate what I want. (sorry for the bad drawing)

I've pinpointed the relevant points on the curves.

The lower curve (the one nearer the x axis) I have all the points (x and y coordinates). It's actually composed out of 5 points and 2 curves. The first curve is composed of the two most bottom left points I have drawn and one at the middle of the curve (which I have not drawn). The other curve that connects to it doesn't matter.

The point I'd like to calculate is the the only point I've shown on the higher curve. I can calculate: $$α = arctan(d / \text{[distance between the two most bottom left points]})$$ $β$ can also be as easily calculated. Still this doesn't seem to help me much to get the coordinates of the point I want. Am I approaching this wrong? Thanks in advance.

-
Seen this? –  Ｊ. Ｍ. Oct 11 '12 at 11:25
The text and the image seem to contradict each other. In the text you say that you want to move the curve "up" (presumably meaning in the $y$ direction?) a distance $d$, and that the second curve is "symmetrical" to the first one (presumably meaning congruent or related by translation?). But in the image the perpendicular distance between the two curves appears to be $d$, which is incompatible with both of the assertions in the text. –  joriki Oct 11 '12 at 11:31
@joriki, I've edited the question to make it clearer. It's not simply moving the curve in the y direction because that'd be trivial. Sorry, I hope that it's better explained now. –  Clash Oct 11 '12 at 11:35
@Clash: Yes, that's clearer, but "move" still seems to imply that the second curve has the same shape as the first, which it doesn't. If I understand correctly, you're actually looking for the shape of the second curve such that the shortest distance to the first curve is the same everywhere. –  joriki Oct 11 '12 at 11:43
yes, exactly joriki! you worded it a lot better than me. –  Clash Oct 11 '12 at 11:49

If your original curve is given in parameter form, i.e. if you have a function $f_1: [a,b] \rightarrow \mathbb{R}^2$ such that your original curve is set of points $\{f_1(t) : t \in [a,b]\}$, then the second curve, also in parameter form, is simply $$f_2(t) = f_1(t) + d\begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix}\frac{f_1'(t)}{|f_1'(t)|}$$ $f'_1(t)$ denotes the derivative of $f$ at $t$. This thus basically says that to get $f_2(t)$, you start at $f_1(t)$, determine the direction of the $f_1$ at $t$ (which is $f_1't(t)$), normalize that vector, rotate by $90$ degree, and scale by $d$ (which is the desired distance between $f_1$ and $f_2$).
Note that this will only work if $d$ is less than the maximal curvatur of $f$. Otherwise, $f_2$ will intersect itself.