NX二次开发UF_MODL_create_surf_from_cloud 函数介绍

149 阅读5分钟

UF_MODL_create_surf_from_cloud

Defined in: uf_modl_freeform.h 
int UF_MODL_create_surf_from_cloud(int point_cnt, double cloud [ ] [ 3 ] , double csys_matrix [ 2 ] [ 3 ] , double bnd_corners [ 4 ] [ 3 ] , int U_degree, int V_degree, int U_patches, int V_patches, int corner_switch, double * average_error, double * max_error, int * max_error_index, tag_t * surface_tag )

overview 概述

Creates a B-surface using a list of existing points. The points may appear in any order. There must be enough points to define a surface with the requested degree and patches and the points should cover the area inside the specified boundaries.

The boundaries of the surface, projected onto the specified X-Y plane, form a quadrilateral. The boundaries can be specified by the optional bnd_corners parameter. These points, projected onto the X-Y plane of the specified coordinate system must form a convex quadrilateral.

The order of the points determine the U and V directions of the resulting surface.

If the pointer to bnd_corners is NULL, the boundaries are the smallest rectangle that encloses the cloud points in the specified X-Y plane. The U direction of the surface is aligned with the X direction and the V direction of the surface is aligned with the Y direction. The X-Y plane may be specified by the optional csys_matrix parameter. If csys_matrix is NULL, the absolute X-Y plane is used. In all cases the Z direction is assumed to be approximately normal to the surface and the surface must not be ambiguous when viewed from this direction.

Normals Z1, Z2, Z3, and other acceptable vectors all produce the same best fit surface. However, Zn produces a dramatically different surface. Other incorrect vectors produces different results, none acceptable. The system cannot detect when this condition occurs.


使用现有点的列表创建一个 B 曲面。这些点可以按任何顺序出现。必须有足够的点来定义一个具有所要求的度和补丁的曲面,并且这些点应该覆盖指定边界内的区域。表面的边界,投射到指定的 X-Y 平面上,形成一个四边形。边界可以由可选的 bnd _ 隅角参数指定。这些点投射到指定坐标系的 X-Y 平面上,必须形成一个凸四边形。这些点的顺序决定了得到的曲面的 U 和 V 方向。如果指向 bnd _ 隅角的指针为 NULL,则边界是将云点包围在指定 X-Y 平面中的最小矩形。表面的 U 方向与 X 方向对齐,表面的 V 方向与 Y 方向对齐。X-Y 平面可以由可选的 csys _ Matrix 参数指定。如果 csys _ Matrix 为 NULL,则使用绝对 X-Y 平面。在所有的情况下,Z 方向被认为是近似正常的表面和表面不得有歧义时,从这个方向观看。法线 Z1,Z2,Z3和其他可接受的向量都产生相同的最佳拟合曲面。然而,锌产生了一个显著不同的表面。其他不正确的向量产生不同的结果,没有可接受的。系统无法检测这种情况何时发生。

UFUN例子

获取源码例子请搜索 里海NX二次开发3000例专栏

parameters 参数

intpoint_cntInputNumber of points in the cloud array.
云数组中的点数。
doublecloud [ ] [ 3 ]InputArray of points [point_cnt][3]. The points may appear in any order. There must be enough points to define a surface of the requested order an they should cover the area within the boundaries specified below. The points should not represent a surface that is ambiguous in the surface normal direction.
点数组[ point _ cnt ][3]。这些点可以按任何顺序出现。必须有足够的点来定义所请求顺序的表面,并且它们应该覆盖下面指定的边界内的区域。这些点不应表示在曲面法线方向上不明确的曲面。
doublecsys_matrix [ 2 ] [ 3 ]InputOrientation - X-Y vectors, the U-V directions of the surface correspond to these X-Y vectors. The surface must be unambiguous in the Z direction. If this pointer is NULL, the absolute X-Y-Z of the data is used.
方向 X-Y 向量,表面的 U-V 方向对应这些 X-Y 向量。曲面在 Z 方向上必须是明确的。如果此指针为 NULL,则使用数据的绝对 X-Y-Z。
doublebnd_corners [ 4 ] [ 3 ]InputBoundary corners - 4 points specifying the corners of the surface. The resulting surface boundaries, projected onto the X-Y plane, specified above, forms a quadrilateral with corners at the projection of these points onto that plane. The U direction of the surface lie in a direction approximately aligned with the 1st and 3rd line segments and the V direction aligned with the 2n and 4th. If this pointer is NULL, the quadrilateral is the max-min box of the input data in the specified X-Y plane.
边界角-指定表面角的4个点。由此产生的表面边界,投影到 X-Y 平面上,如上所述,形成一个四边形,在这些点的投影到该平面上的角。表面的 U 方向大致与第1和第3线段对齐,V 方向与第2n 和第4线段对齐。如果该指针为 NULL,则该四边形是指定 X-Y 平面中输入数据的 max-min 框。
intU_degreeInputDesired degree of the resulting surface in the U direction. Valid values are 1 through 24.
所得曲面在 U 方向上的期望度。有效值为1到24。
intV_degreeInputDesired degree of the resulting surface in the V direction. Valid values are 1 through 24.
所得曲面在 V 方向的期望度。有效值为1到24。
intU_patchesInputNumber of patches desired in the U direction of the resulting surface.
在所得表面的 U 方向上需要的补丁数量。
intV_patchesInputNumber of patches desired in the V direction of the resulting surface.
在所得表面的 V 方向上需要的补丁数目。
intcorner_switchInputCurrently unused.
目前未使用。
double *average_errorOutputThe average distance, in the Z direction, between all input points and the resulting surface.
在 Z 方向上,所有输入点和得到的曲面之间的平均距离。
double *max_errorOutputThe maximum distance, in the Z direction, between all input points and the resulting surface.
在 Z 方向上,所有输入点与得到的曲面之间的最大距离。
int *max_error_indexOutputThe sequence number, within the cloud array, of the point where the maximum error (max_error) occurred.
在云数组中,发生最大错误(max _ error)的点的序列号。
tag_t *surface_tagOutputObject identifier for the resulting surface.
结果表面的对象标识符。