1polygon_z_normal(3) Allegro manual polygon_z_normal(3)
2
3
4
6 polygon_z_normal, polygon_z_normal_f - Finds the Z component of the
7 normal vector to three vertices. Allegro game programming library.
8
10 #include <allegro.h>
11
12
13 fixed polygon_z_normal(const V3D *v1, const V3D *v2, const V3D *v3);
14
15 float polygon_z_normal_f(const V3D_f *v1, const V3D_f *v2, const V3D_f
16 *v3);
17
19 Finds the Z component of the normal vector to the specified three ver‐
20 tices (which must be part of a convex polygon). This is used mainly in
21 back-face culling. The back-faces of closed polyhedra are never visible
22 to the viewer, therefore they never need to be drawn. This can cull on
23 average half the polygons from a scene. If the normal is negative the
24 polygon can safely be culled. If it is zero, the polygon is perpendicu‐
25 lar to the screen.
26
27 However, this method of culling back-faces must only be used once the X
28 and Y coordinates have been projected into screen space using
29 persp_project() (or if an orthographic (isometric) projection is being
30 used). Note that this function will fail if the three vertices are co-
31 linear (they lie on the same line) in 3D space.
32
33
35 cross_product(3), ex3d(3)
36
37
38
39Allegro version 4.4.3 polygon_z_normal(3)