# 2D coordinates of rotating a “bent line”?

I have this problem, when I am given a point A an an XY plane, and I need to find the coordinates of a point B that is of a constant distance of my point A, and my OAB angle is fixed (O being the origin). I need to eventually create a grid in the x-y plane, placing my A in all of the grid points, and need to retireve my B coordinates.

I have made a quick Paint diagram of my problem (sorry for my low artistic skills), where I indicated the position vector of A with a black line - I assume to know this, since I am setting up my grid eventually -, the distance between A and B with a red line - the same length in all cases. I did not draw in the angles, but I tried to make it clear that OAB angle is the same in all cases.

Image

I've so far tried the following approaches:

• calculating the slope of the AB red line by knowing the slope of the OA line and the constant angle between them. After this, I assumed that b1 = a1 + d(AB)*cos(slope) and b2 = a2 + d(AB)*sin(slope). However, this method failed me, because the AB red line changes its slope between positive and negative values, and this - for some reason - messes up my above approach.

• calculating the slope of AB red line again, but this time I tried to intercept it with a circle of radius of the red line around point A. This approach resulted in a tedious expression, and - obviously - two solutions.

Is there an easy, closed (easy to code) expression of finding b1,b2 given a1,a2, d(AB), and OAB angle?

$$(b_1,b_2)=(a_1,a_2)-\vec{n_1}\cdot|AB|\cdot\cos(\angle OAB)+\vec{n_2}\cdot|AB|\cdot\sin(\angle OAB),$$ where $\vec{n_1}={(a_1,a_2)\over|OA|}$ and $\vec{n_2}={(-a_2,a_1)\over|OA|}$.
• First of all, note the minus before $\vec n_1$ (I edited my answer). The angle OAB can perfectly well be greater that $90^\circ$. As for derivation, it's just elementary geometry. Imagine a coordinate system turned in such a way that X axis passes through our point A. What would be the basis vectors of that system? Apparently, $\vec n_1$ and $\vec n_2$. – Ivan Neretin Apr 3 '16 at 21:05