PK_ERROR_code_t PK_TOPOL_facet ( --- received arguments --- const int n_topols, --- number of entities const PK_TOPOL_t topols[], --- entities to be facetted const PK_TRANSF_t topol_transfs[], --- applied transformations const PK_TRANSF_t view_transf, --- viewing transformation const PK_TOPOL_facet_o_t *options, --- options structure --- returned arguments --- PK_TOPOL_facet_r_t *const tables --- addr of tabular structure )
此函数是离散实体到小平面体,函数官方文档为英文,具体见博文最下方:
1、几何匹配:以实体各个面为基础划分网格,每个实体表面互不干扰;
2、拓扑匹配:把实体作为一个整体划分网格,网格的边界顶点总是与相邻的三角网格边界顶点匹配;
3、修剪匹配:不能是面交界处的网格匹配,但可以保证这些网格缝隙或重叠部分不超过公差;
1、max_facet_sides设置网格边数,一般生成三角网格,设置为3;
2、曲线公差:指网格的边与原始实体边的匹配程度,有弦高(curve_chord_tol)、弦长(curve_chord_max)、弦度(curve_chord_ang)三种。
3、曲面公差:网格与原始曲面的匹配程度,有面高(surface_plane_tol)、面度(surface_plane_ang)两种。
4、网格边长:max_facet_width代表最大边长,min_facet_width代表最短边长;正常来说,网格的边长位于最大值与最小值之间。
1、网格示意图,下图以三角网格表示:其中f代表单个网格(f0,f1),e代表网格的边(e0,e1...e6),v代表边的端点(v0,v1...v6);正常边的方向是逆时针方向。
2、对于结构体PK_TOPOL_facet_r_t中的数据如下表所示,均以序号对应:
详细代码和说明参考论文Parasolid与STL的3D数据变换研究:parasolid与stl的3d数据变换研究 - 豆丁网parasolid与stl的3d数据变换研究,parasolid,parasolid格式,parasolid下载,傅立叶变换,小波变换,parasolid viewer,维生素d研究进展,拉普拉斯变换,仿射变换https://www.docin.com/p-898394411.html?docfrom=rrela
最后在NX中离散效果如下:
原始帮助文档内容如下:
Generate a facetted representation of topological entities in tabular form Specific Errors: PK_ERROR_duplicate_array_item topol has duplicates but no transf array PK_ERROR_bad_component topol or view transf is inappropriate PK_ERROR_general_body PK_facet_match_topol_c option can't be used PK_ERROR_field_of_wrong_type PK_facet_match_topol_c requires cull_none_c PK_ERROR_unsuitable_topology entity in topols array is not face or body See Tabular Output of Faceting for more information. Each received topological entity can be a general, solid or a sheet body or face, if any other type of topological entity appears in 'topols' the error PK_ERROR_unsuitable_topology will be returned. If 'topol_transfs' is set to NULL the 'topols' entities are not transformed (and the 'topols' array cannot contain duplicates). If 'topol_transfs' is not NULL, it is an array of PK_TRANSF_t entities of length 'n_topols'. The 'topols' array can contain duplicates in this case. Each entity in 'topols' is transformed by its corresponding entity in 'topol_transfs'. Any entry in the 'topol_transfs' array can be PK_ENTITY_null, indicating that the corresponding entity in 'topols' is not to be transformed. Transforms may only contain translation and rotation components. Reflections, scales and shears are not allowed. The 'view_transf' argument is used when generating view-dependent facet data for the back face culling and the increased local silhouette density options. A perspective view is created if the underlying matrix contains non-zero perspective terms. The argument is set to PK_ENTITY_null in other cases. Facet vertex coordinates are always generated in world coordinates even when a viewing transform entity is provided (such data must be transformed into the viewing coordinate system before display). The PK_TOPOL_facet_o_t options structure defines two sets of controls 1) how the facet mesh is generated 2) which mesh data are returned to the application. The mesh generation options include parameters such as the maximum number of sides per facet and the tolerance values which are to be used when approximating surfaces by planar facets. The data selection options indicate whether the function should calculate and return the following data to the application in tabular form : - topological data (e.g. which vertices are used to construct which facets) - geometric data (e.g. values of vertex coordinates and normals), - tracking data (e.g. which facets were derived from which face entities) - error data (e.g. which entities fail to meet tolerance criteria) The data selection options are defined as fields of a PK_TOPOL_facet_choice_o_t structure, set to PK_LOGICAL_true or PK_LOGICAL_false indicating whether the application requires Parasolid to calculate and return the associated data. Each data selection field name in the PK_TOPOL_facet_choice_o_t structure is matched by a field name in the returned PK_TOPOL_facet_r_t structure, returning details of the underlying topological, geometric, associative or error data in tabular form. The following restrictions apply when generating facet data: - if topology edge matching is on, the 'cull' option must not be used - if topology edge matching is on, a general body will not be facetted - the 'view_transf' matrix may only contain translation and rotation components; reflections, scales and shears are not allowed. - the silhouette density option PK_facet_density_use_view_c only uses the directional component of the viewing transform entity (and it assumes a parallel view). If multiple view_directions are supplied via the option 'view_directions', these directions will override the 'view_transf'. - if incremental facetting is on then only geometry matching is allowed.