Jump to content

Game Development Dictionary


Cross Product (Vector Product)

The cross product is a little more tricky. The cross product between two vectors yields a third vector which is perpendicular to the first two.

For vectors A, B, and a resultant C :

A X B = C

Or in component form :

( A.x , A.y , A.z ) X ( B.x , B.y , B.z ) = ( A.y * B.z - A.z * B.y , A.z * B.x - A.x * B.z , A.x * B.y - A.y * B.x)

This is commonly utilized to compute something known as a surface normal. As by the cross product formula, a normal is simply a vector that is perpendicular to some plane. In graphics, this plane is usually a polygon of some type.

Please note that A X B <> B X A . Ordering is very important in cross products. What actually happens is that B X A will yield a vector which points in the opposite direction of A X B.