struct PK_TOPOL_facet_choice_o_s { int o_t_version; --- version of this PK option struct PK_LOGICAL_t facet_fin; PK_LOGICAL_t fin_fin; PK_LOGICAL_t fin_vertex; PK_LOGICAL_t vertex_point; PK_LOGICAL_t vertex_normal; PK_LOGICAL_t vertex_param; PK_LOGICAL_t point_vec; PK_LOGICAL_t normal_vec; PK_LOGICAL_t param_uv; PK_LOGICAL_t param_dp; PK_LOGICAL_t param_d2p; PK_LOGICAL_t facet_face; PK_LOGICAL_t facet_occ; PK_LOGICAL_t edge_fin; PK_LOGICAL_t edge_occ; PK_LOGICAL_t error_facet; }; typedef struct PK_TOPOL_facet_choice_o_s PK_TOPOL_facet_choice_o_t; Selection of which tables are returned Specific Errors: PK_ERROR_o_t_version_incorrect option structure not initialised correctly PK_TOPOL_choice_o_t The PK_TOPOL_facet_choice_o_t structure specifies which tables the application wishes PK_TOPOL_facet to return. Each field name of the form PK_LOGICAL_t <from>_<to> is set by the application to the value PK_LOGICAL_true or PK_LOGICAL_false indicating whether or not the application wishes PK_TOPOL_facet to return this particular table (via the returned PK_TOPOL_facet_r_t structure). A support macro PK_TOPOL_facet_choice_o_m sets the version field to the current version number of the PK_TOPOL_facet_choice_o_t structure and initialises a sample number of specific fields to PK_LOGICAL_true, sufficient to demonstrate how to return sample data for a simple rendering application. A facet mesh is defined by tables of facet topology, geometry and associative data. Facet topology is described in terms of facet, fin and vertex indices. The tables of facet vertex data point to tables of coordinate, parameter and derivative data. The associative tables match up facets and fins to faces and edges in the original part. facets The outside of a facet is represented by an ordered sequence of 3 or more fins. The fin sequence follows an anti-clockwise order when viewed outside the facet. example The anti-clockwise ordering of fins and connected vertex entities is described later as their `conventional order'. The following diagram illustrates the ordering of fins, viewed from the outside of a quadrilateral facet mesh. ^ | ^ | F | | F | | F | v | v ---------> ------------> --------> --------------- V V | Key | <--------- <------------ <------- | ------------- | ^ | ^ | | | F | | F | | F | F facet | | | | | | V vertex | | v | v | --> fin | ---------> ------------> -------> | | V V --------------- <--------- <------------ <------ ^ | ^ | F | | F | | F | v | v holes in facets If a facet contains holes (having been created with the shape option set to PK_facet_shape_any_c), it is represented by an ordered sequence of exterior fins, followed by one or more sequences of interior fins, representing holes in the facet. The exterior and interior subsequences of fins are separated from each other by a `null fin' value of `-1'. The fin sequence of each interior hole in a face follows an clockwise order when viewed outside the facet. The relative ordering of each interior fin subsequence is arbitrary (other than following the exterior sequence). example Example ------- f1 v1---<--------------------------------------------------------------v4 | v5 v8 v11 | | f5/ \ f8/ \ f11/ \ ^ f4 | / \ / \ / \ | | / \f6 / \f9 / \f12 | f2 v -<---- -<---- -<---- | | v7 f7 v6 v10 f10 v9 v13 f13 v12 | v2--------------------------------------------------------------->---v3 f3 This facet is represented by the sequence f1 f2 f3 f4 -1 f5 f6 f7 -1 f8 f9 f10 -1 f11 f12 f13 \__exterior__/ ^ \_interior_/ ^ \_interior_/ ^ \_interior_/ | | | separator separator separator The relative ordering of the interior subsequences "f5 f6 f7", "f8 f9 f10" and "f11 f12 f13" is arbitrary. Facets will not contain holes (and fin sequences will not contain `null fin' separators) if the shape option has been set to PK_facet_shape_cut_c or PK_facet_shape_convex_c. fins Each facet is assigned an integer value from 0 to (number_of_facets - 1). A fin is represented by an ordered pair of vertices. Each fin follows an anti-clockwise direction (from its tail to its head) consistent with the ordering of fins in a facet. Each fin is assigned an integer value from 0 to (number_of_fins - 1). Each fin can be associated with a co-fin (one belonging to an adjacent facet). In this case, the co-fin will have a value from 0 to (number_of_fins - 1). If a fin lies on the perimeter of the facet mesh, it has no co-fin. A null co-fin value of `-1' is used to represent such a case. `-1' is also returned for fins that lie on edges between facetted faces in the case where geometry or trimmed matching have been requested. A co-fin value of `-2' will be used to represent cases where the associated co-fin for a particular fin has not been found but where a co-fin should exist (i.e. `-1' was not returned in the table). This may be the result of facetting failing on a face (indicated by an entry in the error_facet table), otherwise a co-fin value of '-2' indicates that an error has occurred in fin-fin matching and so the fin-fin table is not correct. Applications should check explicitly that returned co_fin values lie in this range and handle any exceptions as if the fin has no associated co-fin. This check will allow for the format of the fin_fin table to be extended in a later release, using fin values greater than or equal to 'number_of_fins' to denote multiply coincident fins. This case will not occur in the current release because general bodies cannot be facetted using fin_fin matching. It is recommended that the check be added to the application now to avoid the possibility of array bounds errors occurring in the future. vertices Each fin is associated with a vertex index, being the vertex at the fin's head. Each vertex is assigned an integer value from 0 to (number_of_vertices - 1). Facet vertices are of three types; those at original model vertices, those on original model edges and those representing interior points in a face. With interior facet vertices, there is one surface normal and a single set of parameter and derivative data at each vertex. With exterior facet vertices part-way along model edges, there are two surface normals and two sets of parameter and derivative data at each vertex. With exterior vertices at original model vertices, there are N such normals and N sets of such data for the N faces meeting at the vertex (where N >= 2) The facet topology tables are defined using separate vertex indices for each model face. example The diagram shows the top, front and right hand side faces of a cube with two triangular facets on each face (shown in an 'exploded' schematic form). --------- /v4\ v3/ /v11 / \ / / | /v1 \v2/ / | '---------' / | _________ v12__| |v5 v8| | /v10 | / | | / | / | | / |v6 v7| |/v9 --------- facets on the top face are defined as "v1 v2 v4" and "v2 v3 v4" facets on the front face are defined as "v5 v6 v8" and "v6 v7 v8" facets on the r.h.s. face are defined as "v9 v10 v12" and "v10 v11 v12") using the returned subscript Each vertex index can be used as a subscript into the following tables : vertex_point (for the index of its point value) vertex_normal (for the index of its surface normal vector) param_uv, param_dp, param_d2p (for the index into its parameterisation and derivative data) shared geometry Facet vertices from adjacent faces (which have been facetted using the topology matching option) which meet at the same position will refer to the same vertex_point index. In the example above, the vertex_point entries at vertex indices v2, v8, v12 refer to the same integer value, an index in the point_vec vector table. This reduces the volume of geometric data output and allows an application to infer this association from vertex indices having the same vertex_point value. The 'vertex_norm' index is provided because the number of vertex normals is different from the number of vertex point coordinates (there being more than one normal across an model edge or at a model vertex). This level of indirection allows Parasolid to identify cases where vertices of planar facets refer to the same surface normal value and construct the vertex_normal table so that it refers to the same vector entry in the normal_vec table. The 'vertex_param' index is provided as a common index to the parameter and derivative data tables. Parasolid does not identify common entries in these tables and so these have the same number of entries as there are distinct fin vertices. mesh topology Each topology entity (facet, fin or vertex) in the facet mesh is connected to other entities in the mesh. The complete connectivity data are described as the facet mesh topology. types of tables The PK_TOPOL_facet function provides a set of "table names" each of which causes a specific set of connectivity or geometric data to be returned from the facet mesh. one column tables: This table is implemented as an one dimensional array; with the index value of the <from_facet_entity> as a subscript to an array of <to_face_entity>. The array length is also returned explicitly, with the tabular data. two column tables: This form of table is implemented as an array of structures, with each structure containing two (or more) fields. If used to represent a `one to many' mapping (such as facet_fin table) columns are named after the first and second parts of the table name. The tables are returned sorted by numerical order the first column, then by connectivity order using the second column unless specified otherwise. The other use is returning tables of compound data (such as param_uv). The array length is returned explicitly, with the tabular data.