|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
/* ---- Enter your callback code here ----- */
int degree = 3;
int periodicity = 0;
int num_points = NUMBER_POINTS;
double point1[3] = {-0.0539, 0.0511, 0.0000};
double point2[3] = {-0.4801, 0.8428, 0.0000};
double point3[3] = {2.0000, 0.9000, 3.5956};
double point4[3] = {2.3456, 1.3456, 3.7890};
double point5[3] = {3.1000, 2.4567, 3.3214};
double slope1[ 3 ] = {0,0,0};
double slope2[ 3 ] = {0,0,0};
double slope3[ 3 ] = {0,0,0};
double slope4[ 3 ] = {0,0,0};
double slope5[ 3 ] = {0,0,0};
double crvatr1[ 3 ] = {0,0,0};
double crvatr2[ 3 ] = {0,0,0};
double crvatr3[ 3 ] = {0,0,0};
double crvatr4[ 3 ] = {0,0,0};
double crvatr5[ 3 ] = {0,0,0};
/* Point/slope curve attribute array */
UF_CURVE_pt_slope_crvatr_t point_data[NUMBER_POINTS] =
{
{ point1[3],
UF_CURVE_SLOPE_AUTO, slope1[ 3 ],
UF_CURVE_CRVATR_NONE, crvatr1[ 3 ]
},
{ point2[3],
UF_CURVE_SLOPE_NONE, slope2[ 3 ],
UF_CURVE_CRVATR_NONE, crvatr2[ 3 ]
},
{ point3[3],
UF_CURVE_SLOPE_NONE, slope3[ 3 ],
UF_CURVE_CRVATR_NONE, crvatr3[ 3 ]
},
{ point4[3],
UF_CURVE_SLOPE_DIR, slope4[ 3 ],
UF_CURVE_CRVATR_VEC, crvatr4[ 3 ]
},
{ point5[3],
UF_CURVE_SLOPE_VEC, slope5[ 3 ],
UF_CURVE_CRVATR_VEC, crvatr5[ 3 ]
}
};
/*
UF_CURVE_pt_slope_crvatr_t point_data[NUMBER_POINTS] =
{
{ {-0.0539, 0.0511, 0.0000},
UF_CURVE_SLOPE_AUTO, {0,0,0},
UF_CURVE_CRVATR_NONE, {0,0,0}
},
{ {-0.4801, 0.8428, 0.0000},
UF_CURVE_SLOPE_NONE, {0,0,0},
UF_CURVE_CRVATR_NONE, {0,0,0}
},
{ {2.0000, 0.9000, 3.5956},
UF_CURVE_SLOPE_NONE, {0,0,0},
UF_CURVE_CRVATR_NONE, {0,0,0}
},
{ {2.3456, 1.3456, 3.7890},
UF_CURVE_SLOPE_DIR, {0,0,0},
UF_CURVE_CRVATR_VEC, {0,0,0}
},
{ {3.1000, 2.4567, 3.3214},
UF_CURVE_SLOPE_VEC, {0,0,0},
UF_CURVE_CRVATR_VEC, {0,0,0}
}
};*/ /* Arrays of user's defining point data */
double parameters[NUMBER_POINTS] = {0.00, 0.89, 1.73, 2.23, 2.85};
int i, save_def_data = 1;
tag_t spline_tag;
/* Create B-spline curve */
UF_CURVE_create_spline_thru_pts(degree,
periodicity,
num_points,
point_data,
parameters,
save_def_data,
[$spline_tag)]
UF_terminate ();
上面是我创建曲线的程序,如果直接输入点的值的话,可以创建曲线如程序里绿色的部分,但是我定义一个变量,然后把点的值赋值给变量,就不好使了,如程序中红色的部分,请问为什么。 |
|