f(x)=a0+a1*x+a2*x*x+a3*x*x*x, 这种曲线类型UG是不支持的。
同样是曲线,但表达方式有很多种,后来NURBS能表示所有的曲线形状,它就CAD的标准。
譬如C(u)=B0+B1u+B2u^2+....+Bnu^n这样的曲线;
u是参数,C(u)是对应参数u的一个向量,可以是n维向量。这是Bezier的曲线形式。B样条曲线要比这更复杂。
SPLINE_FIT_p_t,我也不清楚,B样条现在我还没有开始学习,只懂一点bezier曲线曲面。所以没有办法帮你啊。
/* Define the data structure used by UF_MODL_create_fitted_spline().
For "By Tolerance" method, you need to at least specify 'degree', 'num_of_points',
'points', 'tolerance' and 'num_of_segments'(must be zero).
For "By Segments" method, you need to at least specify 'degree', 'num_of_points',
'points', and 'num_of_segments'.
The "By Template" method is not supported at this moment.
*/
struct SPLINE_FIT_s
{
double *points; /* coordinates for the points to be fitted.
points[0~2] = (x, y, z) for the 1st point,
points[3~5] = (x, y, z) for the 2nd point,
...
*/
double *slopes; /* The slope values.
slopes[0~2] = start slope when slope_flag = 1 or 3
end slope when slope_flag = 2,
slopes[3~5] = end slope when slope_flag = 3.
*/
double *weights; /* values for user-defined weights. Only positive values are allowed */
double tolerance; /* Tolerance value for the "By Tolerance" method.
This value will be ignored when the 'num_of_segments' is
positive */
int num_of_points; /* Number of points to be fitted */
int slope_flag; /* 0=no slopes, 1=only start slope exists,
2=only end slope exists, 3=both end slopes exist */
int num_of_weights; /* Number of user-defined weights */
int *weight_positions; /* The index of points (from 1 ~ num_of_points) for the user-defined
weights to apply to */
int num_of_segments; /* Number of segments for the "By Segments" method.
Must be set to 0 for "By Tolerance" method. */
int degree; /* The desired degree for the fitted spline */
}; |