|
#include
{- b) \& P& ]! E#include 6 * ?& G$ h# B& b; Q d' z1 d o
#include
4 |1 c- T9 f1 d; g#define NUMBER_POINTS 5
, K0 B- q% @# _0 k9 z1 v( w#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X))) 3 n& f! d' B) g' S
static int report( char *file, int line, char *call, int irc)
5 s: U- V6 G7 @* Z2 g6 f{ " h& |# t% S, O4 c. ~/ _& P& d
if (irc) 8 x u5 I% Q" ]7 i/ `- S
{
' c- ^$ U. e1 i3 f# J char messg[133];
- J# M& a+ N6 ^1 j2 A printf("%s, line %d: %sn", file, line, call);
3 K) y k& X* W0 ^ (UF_get_fail_message(irc, messg)) ? 4 O% m8 g1 O y3 O/ ^6 }
printf(" returned a %dn", irc) : ; J2 g; q B6 F- q! `5 o3 v
printf(" returned error %d: %sn", irc, messg);/
/ B7 y0 {: p/ L P } + V4 L5 T4 a/ R% k, b7 k
return(irc);
; }3 G' e o+ _. g% Y Q} 4 ^ J. A3 `' B) H, R
static void do_ugopen_api(void)
" j3 q5 x$ k5 [: M2 Q{
2 e6 W/ @8 X2 t" \ ^) r) P4 a6 D/* B-spline parameters */ 2 g, l" o* U8 b. Y
int degree = 3; ' C! b- E" M+ @7 k# g
int periodicity = 0; g4 U; d) `" f; I
int num_points = NUMBER_POINTS;
- i6 q" \ W. Y6 T% g: N/* Point/slope curve attribute array */
4 a! M* d; T. R" sUF_CURVE_pt_slope_crvatr_t point_data[NUMBER_POINTS] =
/ W) X- @$ c9 F+ b4 w4 y {
. T3 T1 s8 j5 b) ~. P5 R { {-0.0539, 0.0511, 0.0000},
* H3 F& C5 J/ t' ` g, V$ u UF_CURVE_SLOPE_AUTO, {-0.3597, 0.9639, 0.0000},
* V( k. a0 g8 O' ~ UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000} ) 8 n- J! _ U6 w0 f
}, # b: N/ u; ]2 J# i' y. v n3 w# B
{ {-0.4801, 0.8428, 0.0000},
3 O# A" T* e; r& ?4 T UF_CURVE_SLOPE_NONE, {0.0000, 0.0000, 0.0000}, 6 W+ ~3 q2 E6 t1 N
UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000}
7 K3 \! H+ B5 ^) l& e8 l }, " M& p& \8 j& ^0 A9 T8 Y
{ {2.0000, 0.9000, 3.5956},
3 C& s( S4 N' K/ D* Q8 a UF_CURVE_SLOPE_NONE, {0.0000, 0.0000, 0.0000},
9 q) ^- Y. ?; |7 ~ UF_CURVE_CRVATR_NONE, {0.0000, 0.0000, 0.0000} 9 I: t; D6 k, Y; \( }
}," : e8 R, o' P' K) @5 N
{ {2.3456, 1.3456, 3.7890},
1 r( |0 r" F) l; p. E* Z UF_CURVE_SLOPE_DIR, {0.5000, 1.0000, 0.5000},
~5 _: D5 j1 d0 k UF_CURVE_CRVATR_VEC, {1.0000, -1.0000, 1.0000}
# {" z0 S& \' X9 t+ S- A }, { {3.1000, 2.4567, 3.3214},
! ^2 x- {* e' f/ x1 z6 Q) K. x" M% p UF_CURVE_SLOPE_VEC, {1.0000, -2.0000, 1.0000},
1 W9 {1 m- N( Y! b- @7 i( h( S UF_CURVE_CRVATR_VEC, {-1.0000, -1.0000, -1.0000} } ( D+ t7 ?: V3 e& {" Y" Q; @
};
& B! m/ O! k* G' `
5 K8 l! D4 j0 j) [* r* _/* Arrays of user's defining point data */ 4 c5 C" N3 f. w
double parameters[NUMBER_POINTS] = {0.00, 0.89, 1.73, 2.23, 2.85};
6 Y7 i* \) [) I# e0 r- E8 cint i, save_def_data = 1; 7 }$ E: f5 R" ^7 M
tag_t spline_tag; ) G2 S! T' @; Q0 B' M$ z" n
' E$ m: j2 p* e Y6 X/ E8 e! I7 v/* Create B-spline curve */ , a7 V/ ~ `: K! Q4 _' b8 p+ o; t7 C
UF_CALL(UF_CURVE_create_spline_thru_pts(degree,
" E5 `& u1 S' m6 F. o6 k# c periodicity, 4 k& |& w3 u) O
num_points,
/ X- P( `* o% I$ b point_data,
' ]' A; H8 ~# e8 K) ^5 f( f( v parameters, ) h/ ?7 ^1 ~6 ?( p! B3 w$ m1 W* Y
save_def_data, - ]; @. b) u+ E. L9 J, t
&spline_tag)); ) c9 P0 ~: A5 Q2 G
}
* e; @' \, ~1 l9 D/*ARGSUSED*/ " K; M5 d5 W+ i
void ufusr(char *param, int *retcode, int paramLen)
/ r* U9 t6 D7 t. T- ^{
3 m I0 G. o {# M4 d9 ?1 G3 O if (!UF_CALL(UF_initialize())) 2 O6 X3 L5 x- i" ^+ V
{
: X. S/ S6 s7 V& j do_UGopen_api(); ; K5 j8 I. f' J' m8 ~" V
UF_CALL(UF_terminate()); 9 r | Z- n& W( `3 I
} 7 e+ C0 H% n( H. r
}
" Z8 {7 a4 ^& G8 A$ cint ufusr_ask_unload(void) 0 W8 M/ A9 r5 c! M$ ]
{ # j2 c/ d& C" h( F* ~1 n% @; E5 J% I
return (UF_UNLOAD_IMMEDIATELY);
, \2 Q2 y8 Z& X0 @2 S} 3 n5 y# ~7 h; [* E. D; K( Y
请问程序中的红色的那段程序是不是表示斜率?后面的数字表示什么?! o( U1 R: ]3 l
|
|