|
悬赏5G币未解决
UF_MODL_create_fitted_spline()通过点生成样条曲线 不会用 求指导
* f4 z) J& B8 I% h' U也看过帮助文档,但是没实例,SPLINE_FIT_p_t 这种数据结构没看懂( U f0 j% n# t6 K4 ~2 u8 _! L0 X
static void do_ugopen_api(void) V2 o7 r' S/ j) P! X: _ b, _
{/ Q% d- o: s0 M* M) \4 M7 _
* I' {7 B* V ~5 [# P7 |+ b0 g
double sp1;$ U( a& `' {/ r
9 ?0 s" ?; ^4 J) F double pt[15]={1.1000, 0.5320, 2.0000,6 G V5 n' j' _. O; f8 ?4 C
1.5240, 0.6789, 2.3000,
, U, ^0 t4 D& e' K4 G' i5 T 2.0000, 0.9000, 3.5956,. g. @% _ y# k& I2 U. u' y# k6 O
2.3456, 1.3456, 3.7890,
1 h; x( |" {. y& { 3.1000, 2.4567, 3.3214}; Z6 @6 u3 D0 _! l4 r0 G
int err_pt=0;
6 g5 o6 g1 c3 G* B5 Z int i;
7 E4 g; i# k+ S7 |2 U) p! T tag_p_t curved_id;
- H5 j% G4 a8 w5 [* ~
% l- H+ \9 X5 _7 L& X0 q- I9 Q9 N, j SPLINE_FIT_p_t spdata; //数据结构 这个不会用
# S8 B" H% Z+ l: s R spdata->degree=3;
d& r0 ~" ?* E* o t2 ?( e5 D! I spdata-> num_of_points=5;
: z8 Y$ A) s# N: x# Y spdata->num_of_segments=1;
* c2 d# S$ M2 l double *points;
1 C9 o" Y4 L/ ^6 G" s2 M0 c1 s+ ~; d5 E" A7 J7 o. J
// points " u, j1 ?( ~, n: u( G- e
// double *
2 j0 } C W2 s* c i; A/ a; f o// 8 {/ p2 G7 w5 o v1 B
// coordinates for the points to be fitted. ) H( p* u' g' z' e3 y
// points[0~2] = (x, y, z) for the 1st point, % D. z/ I- b: Z( j3 [6 n
// points[3~5] = (x, y, z) for the 2nd point,
6 A0 p4 J0 Q! u$ l5 ]/ Y// ...( d4 I0 V! C6 G8 K
4 x5 n2 u! w. N7 u8 q
$ z# x6 f1 R: f. y2 C6 m
& v1 U: O. H) x0 G2 K$ J for(i=0;i<15;i++); C2 w9 Z5 k( Q0 P$ t/ u" u; }) ~
{# y( a# u1 \+ E* U
spdata->points[i]=pt[i]; //在这里可能错误 不会赋值2 U1 p2 {# U5 ^& f( l* @
// spdata[i].points[0]=pt[3*i];& |4 p4 f- [! [3 z8 Q
// spdata[i].points[1]=pt[3*i+1];: s5 I/ x+ s; q
// spdata[i].points[2]=pt[3*i+2];, ~% I% U4 b* |* I m- K
. D- C. C& I; A }. t7 b1 v/ `" M
) n) B2 J9 D, G //通过点的样条曲线1 ?1 F5 _& H* V$ s% O( P
UF_MODL_create_fitted_spline(spdata,&sp1,&err_pt,curved_id); - f' h# V9 k) a& t$ K9 _- X
) D. a4 q Z- M, Y# B}
) U" v! |# a' G0 J' L$ P/ n( L
, v2 Q9 M2 c! V7 O |
|