.\" @(#)PEXGeoNormTriangleStrip.3 1.5 95/03/24 SMI; .so man3/pex.macs .TH PEXGeoNormTriangleStrip 3 "May 1995" "Solaris PEXlib Reference Manual" "" .SH NAME PEXGeoNormTriangleStrip - utility function .SH SYNTAX .HP int PEXGeoNormTriangleStrip\^(\^unsigned int \fIfacet_attributes\fP, unsigned int \fIvertex_attributes\fP, int \fIcolor_type\fP, PEXArrayOfFacetData \fIfacet_data\fP, unsigned int \fIcount\fP, PEXArrayOfVertex \fIvertices\fP) .SH PARAMETERS .IP \fIfacet_attributes\fP 1i A mask indicating the facet attributes provided. It should contain the bit .B PEXGANormal. .IP \fIvertex_attributes\fP 1i A mask indicating the vertex attributes provided. .IP \fIcolor_type\fP 1i The type of color data provided. .IP \fIfacet_data\fP 1i An array of facet data. This function adds the geometric normals to this data. .IP \fIcount\fP 1i The number of vertices. .IP \fIvertices\fP 1i An array of vertices defining the triangle strip. .SH RETURNS Zero if successful; otherwise, one of the following: .TP .B PEXBadPrimitive A normal cannot be computed for one or more triangles in the strip. .SH DESCRIPTION .\" indexing .IX PEXGeoNormTriangleStrip .IX "Utility Functions" PEXGeoNormTriangleStrip .LP This function computes the geometric normals of a triangle strip and stores them in the specified facet data. .LP The geometric normal of each triangle is computed by forming two vectors from two of its sides, and computing the cross product of those two vectors. The geometric normal is the normalized cross product: .LP .RS Ng = (V1 x V2) / |V1 X V2| .RE .LP For the first, third, and subsequent odd-numbered triangles, the first vector (V1) is from the first point (Pi) of the triangle to the second point (Pi+1), and the second vector (V2) is from the first point of the triangle to the third point (Pi+2). For the second, fourth, and subsequent even-numbered triangles, the first vector is from the first point (Pi) of the triangle to the third point (Pi+2), and the second vector is from the first point of the triangle to the second point (Pi+1). .LP If the facet attributes does not contain the bit .B PEXGANormal, the geometric normal is not computed. However, the function still returns successfully. .LP A geometric normal is computed for all triangles where it is possible to compute one, even if a normal cannot be computed for some other triangles. An error is returned if a normal cannot be computed for one or more of the triangles in the strip. .SH ERRORS None