int PEXOCCGeoNormIndexedTriangles( PEXOCC context, unsigned int num_facets, PEXPointer occ_facet_data, unsigned int vertex_count, PEXPointer occ_vertex_data, unsigned int index_count, PEXConnectivityData *connectivity, int handedness )
Zero if successful; otherwise, one of the following:
Invoke PEXOCCGeoNormIndexedTriangles to compute the geometric normals of each of the triangles in this list of indexed independent triangles.and store them in the specified facet data.
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:
Ng = (V1 x V2) / |V1 x V2|
A triangle is defined by three entries in the connectivity list, indexed by i, where the first vector (V1) is from the first point (P[connectivityi]) of the triangle to the second point (P[connectivityi+1]), and the second vector (V2) is from the first point of the triangle to the third point (P[connectivityi+2]).
Specify the handedness argument to generate normals that match the orientation of the coordinate system that the vertex data uses. PEXVertexOrderRightHand indicates that the coordinate system is right-handed, and PEXVertexOrderLeftHand indicates that the normals are to be "flipped" from the right-handed orientation to match a left-handed coordinate system.
If the facet attributes does not contain the bit PEXGANormal, then this utility does not compute the geometric normal. However, this utility still returns successfully.
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 primitive.
None.
For a list of utilities that compute geometric normals, see Computing Geometric Normals. For a list of related topics, see PEXlib Utilities.