|
悬赏5G币未解决
UF_MODL_create_fitted_spline()通过点生成样条曲线 不会用 求指导2 K* g/ G, r- c
也看过帮助文档,但是没实例,SPLINE_FIT_p_t 这种数据结构没看懂
) @( q& [6 N, j9 ] P Tstatic void do_ugopen_api(void) ; Z: c; ]. e$ t' H, W
{
4 O/ M# J' y6 ?7 e% {3 \2 N& q 1 `# C2 v3 `4 `% Y6 ]9 H$ q9 H
double sp1;, I4 {; X, k( I: ^2 l
1 W4 |$ \; M7 y/ c
double pt[15]={1.1000, 0.5320, 2.0000,0 s* i- ?0 D$ J# k. {# D& l: e: b0 _
1.5240, 0.6789, 2.3000,5 Z! x" L' Z0 A) H% k6 l- `8 Z& b
2.0000, 0.9000, 3.5956,$ b3 [4 o$ Y# f2 ^1 V
2.3456, 1.3456, 3.7890,
8 f4 |6 u9 T* K' t) F 3.1000, 2.4567, 3.3214};2 W% z, S- `* J. Z, E7 h0 F
int err_pt=0;
4 a2 E0 f D2 y2 {: o int i;
) e! ~, _# {( h4 F tag_p_t curved_id;
0 n* @: V6 s r/ k& y
7 u5 L& N" B& y SPLINE_FIT_p_t spdata; //数据结构 这个不会用
, s' ]( x3 V7 |3 }+ o spdata->degree=3;
! Q. H d& _% L9 q, x$ | spdata-> num_of_points=5;
" a/ w7 i- B% b/ [ spdata->num_of_segments=1;+ Y6 G1 ]" `6 d; h8 u
double *points;% g. t. r: i! y& q
1 d4 e4 S; _3 P% [, }) H: u// points 9 ]8 ?0 `1 K5 D* o1 ?, g
// double *
# ~+ E8 ]. f2 H2 \1 P4 ~: f) {$ Q7 a// " l. b: L6 Q, n7 [7 `6 g# b f
// coordinates for the points to be fitted.
8 |1 C0 E5 U: P" a v t E" N// points[0~2] = (x, y, z) for the 1st point, * `2 n D! c( y; [( m/ A( i6 M5 c
// points[3~5] = (x, y, z) for the 2nd point,
9 D8 i2 S% c! _5 t( R6 t/ b// ...
3 Q5 @5 c3 K0 [3 f! }: f % \7 W4 O( g2 T: ~: `
' C6 ]; M8 D4 R* G8 j2 B7 s- b 7 e1 f7 d" D, y# p2 g
for(i=0;i<15;i++)/ w/ \/ O( r, u2 k
{
* y) f$ {. V4 ~ spdata->points[i]=pt[i]; //在这里可能错误 不会赋值' @0 s6 O; X. u3 X2 C3 Z
// spdata[i].points[0]=pt[3*i];3 n o: ]& \* `; X# A: t- X: a
// spdata[i].points[1]=pt[3*i+1];; M0 M+ g$ A) _
// spdata[i].points[2]=pt[3*i+2];
6 m' n4 K' I# _" v+ Q* W# c( m9 |' C$ g7 y V
}7 e. m% Y- Z4 z' h/ G. O
8 @5 m6 f4 H: Z- g, g& q6 {2 ]
//通过点的样条曲线
/ W, M' u7 y0 A4 U UF_MODL_create_fitted_spline(spdata,&sp1,&err_pt,curved_id); 0 j9 x4 G5 u' O! X: W; @( ?
; t& ]9 k7 t3 N2 ^1 H
}
@- P" ?& M- X( V3 ~! j4 @7 G/ k" y0 \* j8 P7 t) {7 S
|
|