|
#include
0 W4 |: ^8 X( r4 P7 y5 O#include 6 3 Q1 f/ V! `* C) h
#include 7 h( _! e5 z4 Y" y8 \5 B& q
#define NUMBER_POINTS 5 ; o5 \2 z1 D: R t+ V$ B
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
3 t* _9 i+ s Cstatic int report( char *file, int line, char *call, int irc) / J; A! _) v3 ^1 s
{ 3 I: |3 u& R& T3 y2 P
if (irc)
$ n3 ? Q0 c4 z. [ {
% O. v. ^4 j! N, ] char messg[133];
, h* Y% p, h" _: N6 d printf("%s, line %d: %sn", file, line, call);
& [( Z' M q, K$ m5 n (UF_get_fail_message(irc, messg)) ?
2 ?' a" n( b) T( j& F printf(" returned a %dn", irc) :
! i' i/ K" f% _3 ?% @! i printf(" returned error %d: %sn", irc, messg);/
- D) K6 @2 u" X, z2 u, M: [" s } , C+ b. Y% A5 r( `
return(irc); + b1 R5 G( ^3 \ @# }6 k3 x
}
. h- |' N1 \8 R1 _. S4 M2 \. ?static void do_ugopen_api(void) $ a# X4 A- M: R
{ 0 |: ]( G( P& B3 g) ?9 j1 b @
/* B-spline parameters */ % J% ^& J, X& r% a; j+ I9 r0 n
int degree = 3; : n) A) i1 q3 X" T' W/ j' ]
int periodicity = 0; 4 _/ \ ~/ ?9 Q V, q# @* ]
int num_points = NUMBER_POINTS; : Z$ Y6 E5 _- [4 S' F
/* Point/slope curve attribute array */
0 G6 z7 w, b! Z3 m& RUF_CURVE_pt_slope_crvatr_t point_data[NUMBER_POINTS] =
' U9 \9 V5 L; H3 C { , `/ _$ D9 w4 _
{ {-0.0539, 0.0511, 0.0000}, " P8 \4 D' L& N9 j$ ]$ q
UF_CURVE_SLOPE_AUTO, {-0.3597, 0.9639, 0.0000}, W0 c& m5 L% c( i7 r5 I
UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000} )
, l. j+ g& c$ p) a, K& c# A }, 8 r6 o) f& |9 V% C
{ {-0.4801, 0.8428, 0.0000}, 1 E0 s2 p- k0 s$ z" p" i
UF_CURVE_SLOPE_NONE, {0.0000, 0.0000, 0.0000}, * j+ W. A4 W# }- S
UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000} ( X; D. }9 e6 U5 W& _
},
1 N/ p8 [0 ?* y/ Z3 |/ W* H& R { {2.0000, 0.9000, 3.5956},
3 H3 V6 y/ M% u* `" { UF_CURVE_SLOPE_NONE, {0.0000, 0.0000, 0.0000},
$ n+ N4 P& J/ O1 ~* n) K, J UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000} 4 O1 C# D! W4 ^. c0 j
}," 1 [6 n$ V: K1 M8 b1 T
{ {2.3456, 1.3456, 3.7890}, 9 B' e8 F7 @, n2 z. I
UF_CURVE_SLOPE_DIR, {0.5000, 1.0000, 0.5000}, & Z0 ]' s/ `* r' B5 Y y
UF_CURVE_CRVATR_VEC, {1.0000, -1.0000, 1.0000} 1 P7 J' A" \0 C& M
}, { {3.1000, 2.4567, 3.3214}, 8 S! \- x7 `* M# I) X1 T
UF_CURVE_SLOPE_VEC, {1.0000, -2.0000, 1.0000},
& Q* Q8 I) |2 e# m" F1 c UF_CURVE_CRVATR_VEC, {-1.0000, -1.0000, -1.0000} } $ Y* @5 v# j! T
};
I d2 q6 _. W; D- Q
. F. M# S2 ? D% E/* Arrays of user's defining point data */
4 m% \' M4 u! \( _double parameters[NUMBER_POINTS] = {0.00, 0.89, 1.73, 2.23, 2.85}; & [& y1 J5 q; K* @( N
int i, save_def_data = 1;
8 t$ g/ U* ]4 U! \0 {1 ftag_t spline_tag; , q% `* e* e* v/ Q
) M: H& _. k4 ?, E/* Create B-spline curve */ + W+ g k, f' }" k0 x6 d; D) I
UF_CALL(UF_CURVE_create_spline_thru_pts(degree, ! O: e% s$ _& p0 Y$ n( V
periodicity,
1 h5 |+ ?! F4 r* _1 J num_points, ! W! A4 r% u1 a+ f7 G
point_data,
* P. y% h1 M& a* `! s* \4 e parameters,
& a) V! n$ a& ]4 E save_def_data,
+ d8 s, E& @3 ?1 k &spline_tag));
7 k* o! }3 [4 W}
6 {: z o" ]) H- i5 J% {/*ARGSUSED*/
7 D& X8 |9 @9 W2 ~9 P* r5 j+ gvoid ufusr(char *param, int *retcode, int paramLen) / H( Y0 B K! X3 }7 {
{ 0 z# p7 G D8 X o
if (!UF_CALL(UF_initialize()))
! ]0 Y) q6 O8 x* } { ( H) \8 {6 Y. d* p* z9 F
do_UGopen_api();
3 b) v" N" B7 M UF_CALL(UF_terminate());
) ]. p# g$ G! L% Q' s( X } % B0 u5 M2 R6 o( M# i2 a5 \/ K( d
}
0 J4 J. Q2 K/ R8 b' Z/ b9 Zint ufusr_ask_unload(void)
8 G. s( p2 h6 {( Y7 U& O1 j* B{ # n( o5 ?% O6 R( f( @4 T. D$ `: z0 u
return (UF_UNLOAD_IMMEDIATELY); / w7 k: W( t7 ~2 c, [
} 8 I% O6 h/ S3 M2 @, i
请问程序中的红色的那段程序是不是表示斜率?后面的数字表示什么?
7 o. _: D# _2 j; O3 @ X |
|