Vectors, Dot and Cross Products
Robots use two vector products all the time. The dot product says how much two directions agree. The cross product says which way one turns to reach the other.
Drag the tips of a and b.
The two products
In 2D the cross product is a single number, the z part of the 3D cross product. Its size is the area of the shaded parallelogram.
What to notice
The dot product is positive when \(\mathbf{b}\) points roughly the same way as \(\mathbf{a}\), zero when they are perpendicular, and negative when \(\mathbf{b}\) points backward. The cross product is positive when \(\mathbf{b}\) is to the left of \(\mathbf{a}\) and negative when it is to the right.
That gives a robot two quick tests with no trigonometry. Is the target in front of me? Check the sign of the dot product. Should I turn left or right? Check the sign of the cross product. The dashed red line is the projection of \(\mathbf{b}\) onto \(\mathbf{a}\), which is how far the target is along the heading.