马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
我的目标是找到face,读出指定u v 处face的参数
#include <uf.h>
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
# include <strstream>
# include <iostream>
using std:strstream;
using std::endl;
using std::ends;
using std::cerr;
#else
# include <strstream.h>
# include <iostream.h>
#endif
#include "test.h"
#include <uf.h>
#include <uf_modl.h>
#include <uf_part.h>
#include <uf_defs.h>
// Main routine
extern void main( char argc, char *argv[] )
{
/* Initialize the API environment */
int errorCode = UF_initialize();
if ( 0 == errorCode )
{
/* TODO: Add your application code here */
tag_t body_id;/* <I> Face identifier. */
double param[2];/* <I> Parameter (u,v) on face (param[2]). */
double point[3];/* <O> Point at parameter (point[3]). */
double u1[3];/* <O> First derivative in U (u1[3]). */
double v1[3];/* <O> First derivative in V (v1[3]). */
double u2[3];/* <O> Second derivative in U (u2[3]). */
double v2[3];/* <O> Second derivative in V (v2[3]). */
double unit_norm[3];/* <O> Unit face normal (unit_norm[3]). */
double radii[2]; /* <O> Principal radii of curvature (radii[2]). */
UF_PART_load_status_t error_status;
uf_list_p_t face_list;
double wn;
int num;
UF_MODL_create_list(&face_list);
UF_PART_open("D:\\2.prt",&body_id,&error_status);
UF_MODL_ask_body_faces(body_id,&face_list);
UF_MODL_ask_list_count(face_list,&num);
param[0]=0.5;
param[1]=0.5;
UF_MODL_ask_face_props(body_id,param,point,u1,v1,u2,v2,unit_norm,radii);
/* Terminate the API environment */
errorCode = UF_terminate();
}
/* Print out any error messages */
PrintErrorMessage( errorCode );
}
/* PrintErrorMessage
**
** Prints error messages to standard error. */
static void PrintErrorMessage( int errorCode )
{
if ( 0 != errorCode )
{
/* Retrieve the associated error message */
char message[133];
UF_get_fail_message( errorCode, message );
/* Print out the message */
// Construct a buffer to hold the text.
ostrstream error_message;
// Initialize the buffer with the required text.
error_message << endl
<< "Error:" << endl
<< message
<< endl << endl << ends;
// Write the message to standard error
cerr << error_message.str();
}
}
请大虾指点,我建了一个b-splines surface试的,发现读不出来
所以加了
UF_MODL_ask_body_faces(body_id,&face_list);
UF_MODL_ask_list_count(face_list,&num);
来test一下
结果发现num=0 |