I need to find two points on opposite sides of a line in 2D at a distance $d$ from a point on the line.
If the line starts a point $A = (a, b)$ and ends at point $B = (c, d)$ in 2D (normal $x$-$y$-plane), then at a point $C$ located at a distance $t$ along the line from $B$ towards $A$.
I need to find the two points on the perpendicular through $C$ located a distance $s$ from $C$ on opposite sides of line $AB$.
What I have done so far (before my wheels came off) was to find point $C$ as follows:
calculate length = $\sqrt{(A-B) \cdot (A-B)}$
find unit-vector $u = (B-A)/\text{length}$
and so find $C = tu$, along $BA$
and then I got stuck. How do I find the perpendicular to $BA$ through $C$ and the two points at distance $s$ on that perpendicular?
For two dimensional space it is often useful to use complex numbers. Say $A=a+i\ b$, $B=c+i\ d$, and $C =\frac{t}{|A-B|}\cdot{A} +\left(1-\frac{t}{|A-B|}\right)\cdot{B}$
Your 2 points are $C\pm i\ \frac{s}{|A-B|}\cdot{\left(A-B\right)}$
I recommend reading about complex analysis, especially their polar representation, if You are not familiar with it.