|
#include
) y0 J# o5 s# h f6 l#include 6
4 @$ S8 h8 Q; u( u1 l#include / }3 ~7 ?# P4 _9 f8 w
#define NUMBER_POINTS 5
! M+ X7 T, y- |+ D0 H& u#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X))) 9 |. A* M, |4 i; L. N# x( r
static int report( char *file, int line, char *call, int irc)
+ h1 |8 ^1 E& B! w' n- [{
8 O. T( i0 h7 I* x& l if (irc) " C: r' X2 ^4 ]' o, h; z0 q
{
/ H. _+ j" l/ _ char messg[133]; 2 n- R: J/ h) L3 h/ { ~: [
printf("%s, line %d: %sn", file, line, call);
* y4 Z5 ? M" o% U! H: `' Y (UF_get_fail_message(irc, messg)) ?
8 M2 h% `: W9 |7 Y+ x/ U. S! L! A printf(" returned a %dn", irc) : 0 {, t& \+ L( b a6 W
printf(" returned error %d: %sn", irc, messg);/ # `' O/ z% T* \& p, o+ X+ H
} & H: |: l. B& Y e& S( g
return(irc); . p; N w! l+ a0 Y
} . Q3 r0 ]1 R: L. R# z# r
static void do_ugopen_api(void) ' }8 A" v# o+ f/ z" a) v
{
/ F$ P. Z& w5 ~% V* N) k/* B-spline parameters */
. r0 J; R7 H) N$ v' o% z' g0 H fint degree = 3;
4 Q8 B' E- `5 C: n5 |/ h# C& Mint periodicity = 0; 0 [2 C3 M* X# Y4 ]! O3 l
int num_points = NUMBER_POINTS;
1 V9 {- f& h: S) j/* Point/slope curve attribute array */ ( R Y' {. l) F( ?
UF_CURVE_pt_slope_crvatr_t point_data[NUMBER_POINTS] = $ t) }: `% y% V: N% g/ z& U* V
{
1 `% u/ l6 X- D5 N { {-0.0539, 0.0511, 0.0000},
3 a9 n* X! z, h9 ^4 p UF_CURVE_SLOPE_AUTO, {-0.3597, 0.9639, 0.0000},
! Z& w6 W- {6 O: d( ] UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000} ) % V: i2 F$ T t3 f% A: X; E
}, : E( ~' O! Y6 Y
{ {-0.4801, 0.8428, 0.0000},
& D/ {* A2 e5 T: J UF_CURVE_SLOPE_NONE, {0.0000, 0.0000, 0.0000},
4 S) ?- i' E2 w# m+ {* u/ q5 T8 | UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000} 3 d D; i+ D9 l2 Q+ O+ C
},
2 D) _$ p4 c. Y( e# ^9 L& l8 O { {2.0000, 0.9000, 3.5956},
; M( c7 j7 l: b UF_CURVE_SLOPE_NONE, {0.0000, 0.0000, 0.0000},
% g- K* a- }! E" n UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000}
& u5 h) B H3 P! e' V },"
3 C% G& o7 g5 J' M h { {2.3456, 1.3456, 3.7890}, 6 ?7 r$ s8 i! o3 Q. r6 p
UF_CURVE_SLOPE_DIR, {0.5000, 1.0000, 0.5000},
" @9 S% q: ~; R9 b UF_CURVE_CRVATR_VEC, {1.0000, -1.0000, 1.0000} 1 V! C4 o& l$ Z+ V! G% F0 e
}, { {3.1000, 2.4567, 3.3214}, ) W: n: r8 D. S: m4 S
UF_CURVE_SLOPE_VEC, {1.0000, -2.0000, 1.0000}, # h2 T$ L& O: t+ y8 B* S1 Y
UF_CURVE_CRVATR_VEC, {-1.0000, -1.0000, -1.0000} }
3 C" q6 P: M) d2 o( v& q }; 0 O0 o' u7 `6 d) L
. N% }5 _* ^( ^! e/* Arrays of user's defining point data */
`2 e' w$ {7 }4 I, N0 Ndouble parameters[NUMBER_POINTS] = {0.00, 0.89, 1.73, 2.23, 2.85};
$ P0 V. A {4 k- H9 E7 Rint i, save_def_data = 1; . P' H* Q3 ?0 I3 A" b
tag_t spline_tag; # k& _3 O, ?7 K6 J
5 _6 P6 F. g- r9 Q, r& Z
/* Create B-spline curve */ C* o7 U$ M9 }4 a( a3 X$ `* ~
UF_CALL(UF_CURVE_create_spline_thru_pts(degree, # _7 V8 N$ _* C# u& g
periodicity,
S7 ~4 K' N; l4 ~ B& m- E) l, V5 R. I num_points, " Z2 l9 Y. L' }0 S0 v4 L4 m6 r
point_data, 7 S! B) _7 j% r6 J7 j6 Z
parameters,
3 c; j& {3 q" | save_def_data, # T& h R, N; s2 @9 C
&spline_tag)); , k. N) G' f: m p3 V
}
# J: W; v- \8 r2 A9 M* m1 S/*ARGSUSED*/ ; w! g7 _; `3 A7 q# ~" w
void ufusr(char *param, int *retcode, int paramLen)
, b+ m4 o$ L' c* F' h{
+ k) Y# p, y4 W: s' | if (!UF_CALL(UF_initialize()))
) G" x& w0 `$ V { / k0 }8 R8 ~, L) ` F
do_UGopen_api();
- S% l9 W$ Q3 e$ u UF_CALL(UF_terminate());
% l# f; `7 Y' v }
' C4 _" N q! p! j}
$ ]' m5 C* v+ v- Q% ?0 k! V) fint ufusr_ask_unload(void)
* M% l6 B* _8 N5 R# E( h, M# U, z7 M{ & r* s! b/ o: r: @
return (UF_UNLOAD_IMMEDIATELY);
9 g1 {( n0 c" b4 z} # F* ?+ S8 ^$ Y+ j5 z7 w$ a, n; Z
请问程序中的红色的那段程序是不是表示斜率?后面的数字表示什么?
4 }( X! H: F9 {% @ |
|