Calculate angle distance between 2 points (only one "is looking")

524 Views Asked by At

I have two points in a 2D space. One of them is just a point but the other, besides having x and y coordinates has an angle associated: "where it is looking". I have the coordinates of both points and I know the rotation of the second point only with respect to itself. The idea is to measure how much the second point is aiming at the first one, e.g. "the second point is aiming 30 degrees away from the first point". I am trying to implement this function in python and I am interested in knowing an efficient way to do so.

1

There are 1 best solutions below

2
On

The area of triangle AOB can be calculated with:

  • $OB\cdot OA\cdot \sin(O)/2$

  • Heron's formula

With this you can find the angle