iCAx开思工具箱

标题: 曲线镜像失败。请高手指点 [打印本页]

作者: 2323220987    时间: 2004-12-21 09:04
标题: 曲线镜像失败。请高手指点
HELP
作者: 2323220987    时间: 2004-12-21 09:04
TUXIANG
作者: 2323220987    时间: 2004-12-21 09:16
CODE:
  
把图中的 样条曲线段(样条曲线剪切后的一部分)以图中的直线作镜像,无法生成另一条曲线,部分代码如下
int errcod=0;
char errmsg[133];
int one=1,two=2,zero=0;
tag_t line1;
UF_CURVE_line_t sline1;
int type=UF_CURVE_2_CURVE;
double center[3]={43,-2,0};
double radius=3.0 ;
int trim_opts[3]={TRUE,FALSE};
int arc_opts[3];
//tag_t fillet_obj ;
double ref_point2 [3]={42.0,-2.0,0.0};
double ref_point1 [3];
double int_point [3];
tag_t circle1;
tag_t circle2;
tag_t circle3=NULL_TAG;
double first_point[3]={45,0,0};
  double second_point[3]={0,45,0};
  double third_point[3]={-45,0,0};
int     create_flag=2;
int i;
UF_CURVE_arc_t  arc_1 ;
UF_CURVE_arc_t arc_2;
UF_CURVE_arc_t arc_3;
int a=0,b=360,m=3,z=30;
double s,r,X,Y,t=0;
double  pai=3.1415926;
  
int degree = 3;  
  int periodicity = 0;  
  int num_points = 10;
int  save_def_data = 1;  
  tag_t spline_tag=NULL_TAG;  
UF_CURVE_pt_slope_crvatr_t point_data[10];  
int slopeTypes[10] = { UF_CURVE_SLOPE_DIR,  
UF_CURVE_SLOPE_NONE,  
UF_CURVE_SLOPE_NONE,  
UF_CURVE_SLOPE_NONE,  
UF_CURVE_SLOPE_NONE,
UF_CURVE_SLOPE_NONE,  
UF_CURVE_SLOPE_NONE,  
UF_CURVE_SLOPE_NONE,  
UF_CURVE_SLOPE_NONE,
UF_CURVE_SLOPE_DIR
};
double slopeVecs[30] = {1.0000, 0.0000, 0.0000,  
                                       0.0000, 0.0000, 0.0000,  
                                       0.0000, 0.0000, 0.0000,  
                                       0.0000, 0.0000, 0.0000,   
                                        0.0000, 0.0000, 0.0000,  
                                       0.0000, 0.0000, 0.0000,  
                                       0.0000, 0.0000, 0.0000,
                                      0.0000, 0.0000, 0.0000,  
                                       0.0000, 0.0000, 0.0000,  
                                      1.0000, 0.0000, 0.0000
};  
int crvatrTypes[10] = {UF_CURVE_CRVATR_NONE,  
                         UF_CURVE_CRVATR_NONE,  
                         UF_CURVE_CRVATR_NONE,  
                         UF_CURVE_CRVATR_NONE,  
                         UF_CURVE_CRVATR_NONE,
                         UF_CURVE_CRVATR_NONE,  
                         UF_CURVE_CRVATR_NONE,  
                         UF_CURVE_CRVATR_NONE,  
                         UF_CURVE_CRVATR_NONE,  
                         UF_CURVE_CRVATR_NONE
double ref_point[3]={45.0,0.0,0.0};
UF_CURVE_intersect_info_t out_info;
//UF_CURVE_intersect_info_t out_info2;
tag_t  curve_objs[3];
double rr2[12];
int ir3[3];  
  
tag_t nr7[1];
tag_t nr8[1];
int ir9[13];
   /* Make sure User Function is available. */   
     if ( UF_initialize() != 0)  
          return ( UF_UI_CB_CONTINUE_DIALOG );
  
     /* ---- Enter your callback code here ----- */
nr7[0]=NULL_TAG;
nr8[0]=NULL_TAG;
UF_CURVE_create_arc_thru_3pts(create_flag,first_point,second_point,third_point,[$circle1)](生成园)
UF_CURVE_ask_arc_data(circle1, [$arc_1)]
arc_opts[1]=UF_CURVE_TANGENT_OUTSIDE;
  
arc_2.start_angle=0;
arc_2.end_angle=360*DEGRA;
arc_2.radius=48;
arc_3.start_angle=0;
arc_3.end_angle=360*DEGRA;
arc_3.radius=41.25;
for(i=0;i<3;i++)  
  arc_2.arc_center=arc_1.arc_center;  
arc_2.matrix_tag=arc_1.matrix_tag;
  
for(i=0;i<3;i++)  
arc_3.arc_center=arc_1.arc_center;  
arc_3.matrix_tag=arc_1.matrix_tag;
  
UF_CURVE_create_arc([$arc_2,&circle2)] (生成园)
UF_CURVE_create_arc([$arc_3,&circle3)]
  


UF_CURVE_create_spline_thru_pts(degree,periodicity,num_points,point_data,NULL,save_def_data,[$spline_tag)] (生成样条曲线)
UF_CURVE_intersect(circle2,spline_tag,ref_point,[$out_info)](求样条曲线与园的交点)
curve_objs[0]=spline_tag;
curve_objs[1]=circle3;
int_point[0]=point_data[0].point[0] ;  
int_point [1]=point_data[0].point[1] ;  
  int_point[2]=point_data[0].point[2] ;
ref_point1 [0]=point_data[10].point[0];
ref_point1 [1]=point_data[10].point[1];  
  ref_point1 [2]=point_data[10].point[2];
UF_CURVE_edit_trim_curve(spline_tag,circle2,ref_point1,int_point,0);(剪切样条曲线)
  
sline1.start_point[0]=0.0;
sline1.start_point[1]=0.0;
sline1.start_point[2]=0.0;
sline1.end_point[0]=100.0*cos(3*pai/180);
sline1.end_point[1]=100.0*sin(3*pai/180);
sline1.end_point[2]=0.0;
UF_CURVE_create_line([$sline1,&line1)]
FTN(uf5946)([$line1,rr2,ir3)](生成镜像转换矩阵)
FTN(uf5947)(rr2,[$spline_tag,&one,&two,0,&two,nr7,NULL,ir9)](镜像变换)
  
UF_get_fail_message(errcod,errmsg);
if(errcod!=0)  
uc1601(errmsg,1);
作者: 2323220987    时间: 2004-12-22 08:37
怎么没人帮我?




欢迎光临 iCAx开思工具箱 (https://t.icax.org/) Powered by Discuz! X3.3