PEXOCCGeoNormQuadrilateralMesh Utility


Synopsis

 
   int PEXOCCGeoNormQuadrilateralMesh(
       PEXOCC context,
       PEXPointer occ_facet_data,
       unsigned int col_count,
       unsigned int row_count,
       PEXPointer occ_vertices,
       int handedness
   )
 

 
   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

context
An OC context returned by a successful PEXCreateOCC call.

facet_attributes (OCC)
A mask indicating the facet attributes provided. It should contain the bit PEXGANormal.

vertex_attributes (OCC)
A mask indicating the vertex attributes provided.

color_type (OCC)
The type of color data provided.

facet_fp_data_count (OCC)
The number of optional floating-point numbers for each facet.

surface_vertex_fp_data_count (OCC)
The number of optional floating-point numbers for each vertex.

occ_facet_data
A pointer to facet data. This function adds the geometric normal to this data. See Facet / Vertex Data Formats.

facet_data
An array of facet data. This function adds the geometric normals to this data.

col_count
The number of columns in the vertex array.

row_count
The number of rows in the vertex array.

occ_vertex_data
A pointer a the vertex data which is interpreted as a two-dimensional (row-major) array defining the quadrilateral mesh. See Facet / Vertex Data Formats.

vertices
A two-dimensional (row-major) array of vertices defining the quadrilateral mesh.

data_model (OCC)
Specifies the data model used to represent the geometric data.

data_model_specs (OCC)
Offset and size data for the PEXDataStride or PEXDataUnpacked data models.

handedness
Orientation of the coordinate system assumed by the vertex data (PEXVertexOrderRightHand, PEXVertexOrderLeftHand).

Returns

Zero if successful; otherwise, one of the following:

PEXBadPrimitive
A normal cannot be computed for one or more quadrilaterals in the mesh.

Description

Invoke PEXOCCGeoNormQuadrilateralMesh to compute the geometric normals of a quadrilateral mesh and store 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.

PEXGeoNormQuadrilateralMesh assumes the handedness is PEXVertexOrderRightHand.

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 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.

See Also

For a list of utilities that compute geometric normals, see Computing Geometric Normals. For a list of related topics, see PEXlib Utilities.