3 ms·
This is a question of whether the target is to the right or left of the line where the object is pointing. As OskarS says, you don’t need trigonometry for this
by jacobolus 6y ago
This is a question of whether the target is to the right or left of the line where the object is pointing. As OskarS says, you don’t need trigonometry for this at all. Just take the wedge product of the two vectors, and check the sign.
That is, if your direction is the vector (a, b), and the displacement to the target is the vector (c, d), you can compute ad – bc. If this quantity is positive turn left, else turn right.