polygon_z_normal(3alleg)

polygon_z_normal3alleg

Finds the z component of the normal vector to three vertices. allegro game programming library.

Usage

#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);

Overview

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.

Releases

4 releases since Debian 3.1 (Sarge); the text changed 2 times.

  1. 3.1
  2. 4.0
  3. 5.0–6.0

From liballegro-doc 2:4.2.2-2.2 in Debian 6.0 (Squeeze). Parsed by carta from the page's man source.