|
大家好,我是南航大的,在做二次开发。有人知道 SPLINE_FIT_p_t 这个结构体怎么初始化吗? 运行的时候总是出错说:spdata 没有被初始化!求大神解答,感激不尽!!!!!
# N9 t5 ?2 [! I# [+ C1 \# }' S
n! c+ I0 O5 x# B9 W' ^
SPLINE_FIT_p_t spdata; // 截面点数据
! s+ q" Y* l: S# X i' H6 H! o" V
double sp1=0.0;- x5 b9 R. B* \" _8 c- P& Q+ h Y
tag_p_t curved_id=null_tag;$ f; O) a$ Z* X" R l1 _) f
8 g/ o9 |( ^4 a; `& g" q. ^
5 H$ {: I8 t, @ int err_pt=0;+ o9 |. @ P, K0 G
int l=0,i=0;
$ ^) f! q2 i; }! E D8 c6 h" ^ spdata->degree=3;
. v1 C" `" o: r! Z* I+ A4 M+ | spdata->num_of_points=data_n;$ F* j+ V* G$ |) o- d m4 K
spdata->num_of_segments=0; //"By Tolerance
- C( f! X) ~6 d3 E8 W: T# c// spdata.weights=1.0; A f* s( W/ @; i$ s; o+ H
// spdata.num_of_weights=2; P; _& b9 l& _( U. ^0 W/ E% i2 P- c
// spdata.weight_positions=2;, s& U: G7 i& @: G3 h ~1 W
; {$ T' n6 o! U3 z* @
spdata->slope_flag=3;- s- |. i! `5 `' i% _9 n
9 a5 L3 F, y/ p$ r
9 {# a+ [6 I8 O$ J N6 J2 L
spdata->slopes[0]=slopeVecs[1][0];
1 ?) o) H- \/ |, K$ t spdata->slopes[1]=slopeVecs[1][1];9 x& p8 d# n( K5 I
spdata->slopes[2]=slopeVecs[1][2];
" K$ ]! ?' g! X6 n8 C! b& h6 F: U8 A( I0 a9 N, L
if (i=data_n-2)
5 n4 V* ] E8 {" V1 t8 E9 m9 _ {
1 D" h8 O S2 Y& `9 W, z7 v spdata->slopes[3]=slopeVecs[0];& w/ K+ K A; c9 ^* R% [& W
spdata->slopes[4]=slopeVecs[1];2 W4 C3 j3 ~* M
spdata->slopes[5]=slopeVecs[2];
2 P5 m/ E% m+ w5 R4 `/ \( E0 R; J
9 p& b8 @+ e* E6 J! R7 j! q }
" ~- u7 w8 Z0 @% j, J+ F3 s Z1 d, y$ b) } U" X
spdata->tolerance=0.025;
1 c, f1 `) U; A6 `7 S! u double points[1000];% `/ Z, j& p& ~2 Q, V4 K
, g. p; ~) i' S/ B$ [# E! m& C3 w. ^ for(int n=1;n<data_n-1;n++)
# d0 p1 v& \, X- K: G3 c {
3 c2 U1 A1 V$ ~ spdata->points[l]=Pt_vec[n][0];7 a7 C7 t) {! T- v
spdata->points[l+1]=Pt_vec[n][1];
; A: I( _ c) z* r6 u& g spdata->points[l+2]=Pt_vec[n][2];, v0 p c# b# v/ j4 g1 T7 }+ h
l=l+3;
2 r& c( G |5 @( y6 c& H }
Q4 D# t8 s- a( o4 F
8 I) o: a# u% ^2 e h // spdata.points=points;
1 |( P+ e+ _) J, D! V + s5 N# }! D; v1 g! ]7 K$ V3 u( ^
( c4 ?) E3 b# h8 T* b5 U //通过点拟合样条曲线
( X2 e' B- K! |7 o; V# O' ] UF_MODL_create_fitted_spline(spdata,&sp1,&err_pt,curved_id);
7 M; M* F/ p& o2 j3 I) K" ^7 y5 i
7 N2 t1 w' s- A4 L
4 |2 ~& k/ Z! t |
|