---
name: "polygon_z_normal"
section: "3alleg"
platform: "linux"
package: "liballegro-doc"
version: "2:4.2.2-2.2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/polygon_z_normal"
---

# polygon\_z\_normal(3alleg)

Finds the Z component of the normal vector to three vertices. Allegro game programming library.

## NAME

polygon\_z\_normal, polygon\_z\_normal\_f - Finds the Z component of the normal vector to three vertices. Allegro game programming library.

## SYNOPSIS

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

**fixed polygon\_z\_normal(const V3D \*v1, const V3D \*v2, const V3D \*v3);**

**float polygon\_z\_normal\_f(const V3D\_f \*v1, const V3D\_f \*v2, const V3D\_f \*v3);**

## DESCRIPTION

Finds the Z component of the normal vector to the specified three  vertices (which must be part of a convex polygon). This is used mainly in  back-face culling. The back-faces of closed polyhedra are never visible  to the viewer, therefore they never need to be drawn. This can cull on  average half the polygons from a scene. If the normal is negative the  polygon can safely be culled. If it is zero, the polygon is perpendicular  to the screen.

However, this method of culling back-faces must only be used once the X and Y coordinates have been projected into screen space using persp\_project() (or if an orthographic (isometric) projection is being used). Note that this function will fail if the three vertices are co-linear (they lie on the same line) in 3D space.

## SEE ALSO

[**cross\_product**(3alleg)](/cross_product/3alleg.md), [**ex3d**(3alleg)](/ex3d/3alleg.md)
