Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ PEXGeoNormTriangleStrip(3) — Open3D 4.96

Media Vault

Software Library

Restoration Projects

Artifacts Sought

PEXGeoNormTriangleStrip(3)  —  Subroutines

Name

PEXGeoNormTriangleStrip

Synopsis

int PEXGeoNormTriangleStrip(unsigned int facet_attributes, unsigned int vertex_attributes, int color_type, PEXArrayOfFacetData facet_data, unsigned int 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. 

countThe number of vertices. 

verticesAn array of vertices defining the triangle strip. 

Returns

Zero if successful; otherwise, one of the following:

PEXBadPrimitive - A normal cannot be computed for one or more triangles in the strip. 

Description

This function computes the geometric normals of a triangle strip and stores 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|

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

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

Errors

None

See Also

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026