The cross product →v×→w of two vectors →v and →w can be seen as a measure of how perpendicular they are.
It is defined in 2D as:
→v×→w=‖→v‖‖→w‖sinθ
where ‖→v‖ and ‖→w‖ are the lengths of the vectors and θ is the amplitude of the oriented angle from →v to →w.
The cross product has a very simple expression in cartesian coordiantes. If →v=(vx,vy) and →w=(wx,wy) then
→v×→w=vxwy−vywx
static double cross(Point v, Point w) { return v.x * w.y - v.y * w.x; }
Geometric interpretation
The cross product →v×→w can be seen as a measure of how perpendicular the two vectors are.
The sign of the cross product indicates whether →w is to the left or to the right of →v.
- →v×→w>0: →w is to the left of →v
- →v×→w<0: →w is to the right of →v
- →v×→w=0: →w and →v are aligned

In general, we take the angle between the vectors θ in ]−π,π] so that the dot product is positive if 0<θ<π, negative if −π<θ<0 and zero if θ=0 or θ=π:
