LerpworksAcademy
On this page

Math and physics › Vectors

Cross product: an arrow perpendicular to two others

Know first: Vectors: arrows you can add, Dot product: how much two arrows point the same way, Angles, sine and cosine: a point on a circle

The cross product turns two arrows into a third. The new arrow stands perpendicular to both, and its length equals the area of the parallelogram they span. Games use it to find the normal of a triangle and to tell which side of a face turns toward the camera. It also decides whether a target is on the left or the right, and whether a pixel falls inside a triangle. The lesson starts in 2D, where everything comes down to one number with a sign. Then it moves to 3D: where the formula comes from, and why it has two pictures, one for the right hand and one for the left.

Why this matters

The dot product tells you how much two arrows point the same way. Often you need something else: an arrow perpendicular to both. Lighting needs the normal of a triangle, the perpendicular to its face. A camera needs “up” once “forward” and “right” are known. Physics needs the axis a nut turns around when you push on the handle of a wrench.

In 2D the same calculation gives one number with a sign. A character uses it to tell whether a target is on its left. The graphics card uses it to find out which pixels a triangle covers and which side of the triangle faces the camera.

Further in the article

  1. In 2D: area with a sign
  2. The sign: left or right
  3. In 3D: an arrow that sticks out of a sheet
  4. Right hand and left hand
  5. The normal of a triangle
  6. Is the point inside the triangle?
  7. Where else it shows up in games
  8. Where it breaks
  9. Connections: the same idea in other fields
  10. Key points
  11. Test yourself