---
name: "cross_product"
section: "3alleg4"
platform: "linux"
package: "allegro4-doc"
version: "2:4.4.3.1-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/cross_product/3alleg4"
---

# cross\_product(3alleg4)

Calculates the cross product. Allegro game programming library.

## NAME

cross\_product, cross\_product\_f - Calculates the cross product. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**void cross\_product(fixed x1, y1, z1, x2, y2, z2, \*xout, \*yout, \*zout);**

**void cross\_product\_f(float x1, y1, z1, x2, y2, z2, \*xout, \*yout, \*zout);**

## DESCRIPTION

Calculates the cross product (x1, y1, z1) x (x2, y2, z2), storing the  result in (\*xout, \*yout, \*zout). The cross product is perpendicular to  both of the input vectors, so it can be used to generate polygon normals.

## SEE ALSO

**dot\_product**(3alleg4), **polygon\_z\_normal**(3alleg4), **normalize\_vector**(3alleg4), **exstars**(3alleg4)
