|
#include 7 M. w5 l" i* W6 H+ `
#include 6 . f* ]# v, U2 j! P1 c- |& O6 r! b
#include
2 M5 ?, \/ z$ U#define NUMBER_POINTS 5 1 G$ \* w1 J) ~9 c8 j$ S
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
0 z$ a; T/ ^9 g6 Mstatic int report( char *file, int line, char *call, int irc)
1 k- [: ?; S: ^ B2 _+ M& w6 h( H{ 3 Z7 {4 K( I4 p/ d
if (irc)
9 H3 L6 v1 Y( w, z& k+ T { 5 O- Y8 k) l* r5 S' m @
char messg[133];
6 w' ^' H# p# N printf("%s, line %d: %sn", file, line, call); ; J, a3 @7 V# }+ T6 A
(UF_get_fail_message(irc, messg)) ? ' F7 Z7 c; k7 \
printf(" returned a %dn", irc) :
7 G$ i" h0 p" m4 Z9 {3 W2 d6 Z printf(" returned error %d: %sn", irc, messg);/
: M/ ?$ i0 T2 P3 s) i9 | } 7 t- T e& O: T+ R$ U
return(irc); & `# Q" j8 X+ T4 a8 F
}
5 \2 {/ P% m9 m! a# L8 Tstatic void do_ugopen_api(void) * h6 u/ q3 {+ l+ [4 q
{ 2 u- {9 |' |" g- q5 }( ^
/* B-spline parameters */ 4 c! e1 d4 ~+ y/ R- p3 b
int degree = 3;
7 O! ]; a* m8 E% p1 C# p* kint periodicity = 0;
* |& E4 y/ ]3 uint num_points = NUMBER_POINTS; ) d# @) z, x# M) Z/ V
/* Point/slope curve attribute array */ * G/ |0 M; Z9 S9 r
UF_CURVE_pt_slope_crvatr_t point_data[NUMBER_POINTS] =
$ u8 F, l4 M& t1 T {
7 ~8 n5 m2 o+ t: B. a { {-0.0539, 0.0511, 0.0000},
1 [9 a8 v2 h" M% C UF_CURVE_SLOPE_AUTO, {-0.3597, 0.9639, 0.0000}, q2 W# U0 J3 [- ~5 P
UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000} )
# v6 W, T. j1 |7 I! E# A }, $ u, X" C$ r' p+ U2 h2 i7 L
{ {-0.4801, 0.8428, 0.0000},
8 X5 }; T* W& C UF_CURVE_SLOPE_NONE, {0.0000, 0.0000, 0.0000},
/ b# H- ]& h( N7 n# u! R6 P8 p UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000}
1 u8 O w- I) ` },
, f* g7 Z6 R* p0 t$ p { {2.0000, 0.9000, 3.5956},
- \( R1 q1 q1 h2 l: h/ Q UF_CURVE_SLOPE_NONE, {0.0000, 0.0000, 0.0000}, : I, S/ M! F0 u2 C5 c6 c2 U
UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000} 4 a/ C& n& U6 G- e+ G& c
},"
6 ]( C( k$ B2 A# p, f! o { {2.3456, 1.3456, 3.7890}, / V4 j+ A, u: x/ Z6 \! [/ R
UF_CURVE_SLOPE_DIR, {0.5000, 1.0000, 0.5000},
$ P4 N7 n, k) I6 r UF_CURVE_CRVATR_VEC, {1.0000, -1.0000, 1.0000} / U3 ]/ K+ W% R* S3 W/ S F5 W' w
}, { {3.1000, 2.4567, 3.3214}, T; s4 j! V( r. R1 w" ]# o
UF_CURVE_SLOPE_VEC, {1.0000, -2.0000, 1.0000}, 7 O- [) Y7 i+ ]0 Q
UF_CURVE_CRVATR_VEC, {-1.0000, -1.0000, -1.0000} } * L( H" T0 E+ z0 B. J
}; ( V2 Q4 w: n: }
+ o3 [2 k1 i4 q1 M. X/* Arrays of user's defining point data */
) T& {4 A1 a1 f# G- cdouble parameters[NUMBER_POINTS] = {0.00, 0.89, 1.73, 2.23, 2.85}; ( p2 k: l9 l4 Q1 l9 e1 S, l
int i, save_def_data = 1;
- w- e9 S) E6 k- U# T7 [( _" btag_t spline_tag;
, F- g. N. a7 x0 R) \% {( j9 E$ C6 ^. w7 R! P$ n% A
/* Create B-spline curve */
* ]6 e4 {' [" U" B$ Y! z6 M2 HUF_CALL(UF_CURVE_create_spline_thru_pts(degree,
/ g4 i7 `* U' \5 v' g- e periodicity, . U% d; Z2 t1 T0 t, Z( k1 v- k
num_points,
" S: F1 K& M: Y4 j$ g, |8 _; k. Z1 G point_data,
# ? g; q( X8 g P6 w& d1 _ parameters,
9 x* U! V" w3 `/ D' j$ B( N) ^4 V save_def_data,
1 E6 ^8 }7 p; T& e+ @1 m5 i' N! o &spline_tag));
8 e& w u, q: @; \" i# Z1 ]1 j2 w$ {( \} 7 t; x- M5 T, m' P1 x
/*ARGSUSED*/
2 `: Q/ Y! u% m" avoid ufusr(char *param, int *retcode, int paramLen) ; [% Q5 \0 p! ~! s3 S
{ ! t: R/ {* q" t5 G( P
if (!UF_CALL(UF_initialize()))
& K& R/ K3 u( d } i {
+ q5 p0 j: ~0 L: s4 b do_UGopen_api(); # R. o9 q/ M8 Z* S4 Q2 D9 I, m
UF_CALL(UF_terminate());
8 B, g6 }& Z/ V8 l% V } . V3 c) {0 U& V1 C. {
}
0 n; G: U! L: Y, o' Nint ufusr_ask_unload(void)
, f' m9 |8 j- A% U( E2 R{
. S" ?, a2 s, f" F& G return (UF_UNLOAD_IMMEDIATELY);
0 W5 s% k0 O1 ]} # a8 N7 d2 {# W J* \' V! Q7 b
请问程序中的红色的那段程序是不是表示斜率?后面的数字表示什么?! u6 |4 Q7 @% T
|
|