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.


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?

Thanks in advance!


$$(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|}$.

Your first method should have worked as well, though.

  • $\begingroup$ Thanks, this formula looks simple enough. However, when I try to use it, it seems to fail for angles between 90 and 180 degrees. Am I doing it wrong? By the way, what is the source of this formula? $\endgroup$ – Ezze Apr 3 '16 at 20:52
  • $\begingroup$ Giving it a second thougt, I sort of answered my own question. The angle of two lines can not be greater than right angle. I got it now. Still, I am wondering, how to derive your formula? $\endgroup$ – Ezze Apr 3 '16 at 20:59
  • $\begingroup$ 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$. $\endgroup$ – Ivan Neretin Apr 3 '16 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.