用UF_MODL_ask_face_props求法向是正确的,但求曲面(U=0.5,V=0.5)位置结果不对
我这个电极的尺寸45.000x18.000x20.029
求出来的点数据明显超大
代码如下:
- #include <uf.h>
- #include <uf_exit.h>
- #include <uf_ui.h>
- #include <uf_modl.h>
- #include <uf_disp.h>
- #if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
- # include <strstream>
- # include <iostream>
- using std::ostrstream;
- using std::endl;
- using std::ends;
- using std::cerr;
- #else
- # include <strstream.h>
- # include <iostream.h>
- #endif
- #include "ask_props.h"
- extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
- {
- int errorCode = UF_initialize();
- if ( 0 == errorCode )
- {
- int irc = 0;
- char *message = "Select Object";
- UF_UI_selection_options_t opts;
- UF_UI_mask_t mask;
- int response;
- tag_t object, view;
- double cursor[3];
-
- UF_initialize();
- opts.other_options = 0;
- opts.reserved = NULL;
- opts.num_mask_triples = 1;
- opts.mask_triples = &mask;
-
- opts.mask_triples->object_type = UF_solid_type;
- opts.mask_triples->object_subtype = UF_solid_face_subtype;
- opts.mask_triples->solid_type = UF_UI_SEL_FEATURE_ANY_FACE;
- while (response!=2)
- {
- opts.scope = UF_UI_SEL_SCOPE_WORK_PART;
- irc = UF_UI_select_single(message,&opts,&response,
- &object,cursor,&view);
-
- if (response==5)
- {
- double face_param[2],face_point[3],face_u_deriv1[3];
- double face_v_deriv1[3],face_u_deriv2[3],face_v_deriv2[3];
- double face_normal[3],face_radii[2];
- char msg[256];
-
- face_param[0] = 0.5;
- face_param[1] = 0.5;
-
- UF_MODL_ask_face_props(object,
- face_param,
- face_point,
- face_u_deriv1,face_v_deriv1,
- face_u_deriv2,face_v_deriv2,
- face_normal,face_radii);
- sprintf(msg,"曲面(U=0.5,V=0.5)位置:\n X = %.3f\n Y = %.3f\n Z = %.3f \n\n曲面法向:\n I = %.3f\n J = %.3f\n K = %.3f \n\n",
- face_point[0],face_point[1],face_point[2],
- face_normal[0],face_normal[1],face_normal[2]);
- uc1601(msg,1);
- UF_DISP_set_highlight(object,0);
- }
- }
- errorCode = UF_terminate();
- }
- }
- extern "C" int ufusr_ask_unload( void )
- {
- return( UF_UNLOAD_IMMEDIATELY );
- }
复制代码 |