PEXGeoNormQuadrilateralMesh(3) — Subroutines
Name
PEXGeoNormQuadrilateralMesh
Synopsis
int PEXGeoNormQuadrilateralMesh(unsigned int facet_attributes, unsigned int vertex_attributes, int color_type, PEXArrayOfFacetData facet_data, unsigned int col_count, unsigned int row_count, PEXArrayOfVertex vertices)
Arguments
facet_attributes
A mask indicating the facet attributes provided. It should contain the bit PEXGANormal.
vertex_attributes
A mask indicating the vertex attributes provided.
color_typeThe type of color data provided.
facet_dataAn array of facet data. This function adds the geometric normals to this data.
col_countThe number of columns in the vertex array.
row_countThe number of rows in the vertex array.
verticesA two-dimensional (row-major) array of vertices defining the quadrilateral mesh.
Returns
Zero if successful; otherwise, one of the following:
PEXBadPrimitive - A normal cannot be computed for one or more quadrilaterals in the mesh.
Description
This function computes the geometric normals of a quadrilateral mesh and stores them in the specified facet data.
The geometric normal of each quadrilateral 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|
Given the quadrilateral composed of four vertices, Pi,j, where i indicates the row of the point and j its column, the first vector, V1, is from Pi,j to Pi+1,j+1. The second vector, V2, is from Pi+1,j to Pi,j+1.
If the facet attributes does not contain the bit PEXGANormal, the geometric normal is not computed. However, the function still returns successfully.
A geometric normal is computed for all quadrilaterals where it is possible to compute one, even if a normal cannot be computed for some other quadrilaterals. An error is returned if a normal cannot be computed for one or more of the quadrilaterals in the mesh.
Errors
None