点击查看详细介绍

UF_MODL_evaluate_face() 函数的参数解释说明、函数详细用法,以及实例代码演示

misnn 10年前 1750 0

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


函数结构:
UF_MODL_evaluate_face
(
tag_t face_tag,
int deriv_request,
double parms [ 2 ],
UF_MODL_SRF_value_p_t eval_result
)

函数说明:
计算一个面的请求的衍生物在给定的参数值。

函数参数:
第1个参数为输入:
face_tag代表参数变量,tag_t 为输入参数类型,脸部标记

第2个参数为输入:
输入int 整数型的参数,参数的变量格式为deriv_request,导数的顺序来计算:UF_MODL_EVAL - 位置UF_MODL_EVAL_DERIV1 - 位置和第一部分UF_MODL_EVAL_DERIV2 - 位置,第一部分和第二部分UF_MODL_EVAL_DERIV3 - 位置,第一,第二和第三谐音默认为UF_MODL_EVAL_DERIV2为混合面临UF_MODL_EVAL_UNIT_NORMAL - 位置,第一谐音和成套 正常。 UF_MODL_EVAL_NORMAL - 位置,首先泛音和ununitized正常。 UF_MODL_EVAL_ALL - 位置,法线和所有的谐音到三阶。默认为UF_MODL_EVAL_DERIV2为混合面孔

第3个参数为输入:
输入double 双精度类型的参数,参数的变量格式为parms [ 2 ],UV值在该衍生物是要被计算。

第4个参数为输出:
eval_result代表参数变量,UF_MODL_SRF_value_p_t 为输出参数类型,指向包含位置和衍生物的结构:srf_pos[3] - 位置srf_du[3] - D /杜srf_dv[3] - D / DV srf_unormal[3] - 单元正常srf_d2u[3] - D2 / DU2 srf_dudv[3] - D2 / dudv srf_d2v[3] - D2 / DV2 srf_d3u[3] - D3 / DU3 srf_d2udv[3] - D3 / du2dv srf_dud2v[3] - D3 / dud2v srf_d3v[3] - D3 / DV3 srf_normal[3] - e/杜x深/ DV

UF_MODL_evaluate_face函数实例代码演示:

[quote]
#include <stdio.h>
#include <uf.h>
#include <uf_csys.h>
#include <uf_curve.h>
#include <uf_defs.h>
#include <uf_modl.h>
#include <uf_obj.h>
#include <uf_object_types.h>
#include <uf_part.h>
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
if (irc)
{
char messg[133];
printf("%s, line %d: %s\n", file, line, call);
(UF_get_fail_message(irc, messg)) ?
printf(" returned a %d\n", irc) :
printf(" returned error %d: %s\n", irc, messg);
}
return(irc);
}
void ufusr( char *param, int *retcod, int param_len )
{
UF_MODL_SRF_value_t eval_surf;
char *cone_diams[] = {"5.", "2."};
char *part_name = "face";
char cone_height[] = "5.";
double axis[] = {0., 0., 1.};
double box[6];
double center[3];
double cone_origin[] = {15., 2.5, 0.};
double dir[3];
double face_pnt[3];
double min_max_box[4];
double parm[2];
double point[3];
double rad;
double rad_data;
double radius;
int deriv_request;
int count;
int i;
int norm_dir;
int rc;
int sen;
int type;
tag_t body;
tag_t cone_feat_id;
tag_t face;
tag_t face_id;
tag_t part;
uf_list_p_t face_list;
UF_initialize();
UF_PART_new(part_name, UF_PART_ENGLISH, &part);
/* build a cone and get the id of the conical face */
UF_CALL(UF_MODL_create_cone1(UF_NULLSIGN, cone_origin,
cone_height, cone_diams, axis, &cone_feat_id));
UF_CALL(UF_MODL_create_list(&face_list));
UF_CALL(UF_MODL_ask_feat_body(cone_feat_id, &body));
UF_CALL(UF_MODL_ask_body_faces(body,&face_list));
UF_CALL(UF_MODL_ask_list_count(face_list, &count));
for(i = 0; i < count; i++)
{
UF_CALL(UF_MODL_ask_list_item(face_list, i, &face));
UF_CALL(UF_MODL_ask_face_data(face, &type, center,
dir, box, &radius,
&rad_data, &norm_dir));
if(type == UF_cone_type)
{
face_id = face;
}
}
UF_CALL(UF_MODL_delete_list(&face_list));
UF_CALL(UF_MODL_ask_face_data(face_id,&type,point,dir,
box,&radius,&rad,&sen));
/*
return the position and parameters of the face for the
given reference point. The location of the point on the
face is immaterial for this example. When we evaluate
the face at the resulting parm, we should get the face
point back
*/
UF_CALL(UF_MODL_ask_face_parm(face_id,point,parm,face_pnt));
printf("face_pnt = %f %f %f\n",
face_pnt[0], face_pnt[1], face_pnt[2]);

/* evaluate the position and the unitized normal at parm */
deriv_request = UF_MODL_EVAL_UNIT_NORMAL
rc = UF_MODL_evaluate_face(face_id,
deriv_request,
parm,
eval_result);
if ( rc != 0 )
{
printf("position = %f %f %f\n",eval_surf.srf_pos[0],
eval_surf.srf_pos[1],
eval_surf.srf_pos[2]);
printf("unitized normal = %f %f %f\n",eval_surf.unormal[0],
eval_surf.unormal[1],
eval_surf.unormal[2]);
}
UF_terminate();
}




[/quote]

0

最新回复 (0)
请登录后发表新帖