|
我的思路: 选定直线后 取出线的2个端点,根据取出的端点再给定偏置距离得到新的点。 / m) v6 w) r0 O$ O7 F) B
* _" J! L0 p$ W7 Z. X3 j
如图:/ b$ n' [6 C. C/ B0 p
& J( t) E( \; r$ ~7 Z& q
看我代码: C0 ^1 x: ], ~9 n. w
int CHANGE_action_9_act_cb ( int dialog_id,* w. _3 O+ D/ _& E
void * client_data,
1 E2 t4 ?3 d* R) B0 Q9 e UF_STYLER_item_value_type_p_t callback_data)
+ H6 j% \8 n4 m0 x2 @0 r{
/ a3 O! W/ B! i# V' b% r# D /* Make sure User Function is available. */
g: ^2 y0 d# l' { if ( UF_initialize() != 0)
! n: A3 G4 S1 X( z return ( UF_UI_CB_CONTINUE_DIALOG );0 A0 m2 l0 J Q9 I( `+ Y
/* ---- Enter your callback code here ----- */
% N& V& B# s4 i int err = 0;
6 \& \' H- o4 }$ ^ char *message = "Select point";3 k+ K! E* Y- n0 O0 V4 A& L* h3 k
double point_coords[3];
: `8 w7 ?( @7 M UF_UI_selection_options_t opts;
" \* [0 B5 z: q& o* Q( T UF_UI_mask_t mask[1] = {{UF_line_type, 0, 0}};
. ~8 ~5 L0 J3 I; h( C& _- j; I8 m9 n
- C8 z8 B* |! u& k0 y# g int response;
! ^) v' B* Z2 h8 B5 [% | double cursor[3];$ h; I t+ l* F9 X$ g7 d
double A[3],B[3];" T% q8 T/ j0 y3 m
tag_t object, view;
& s7 ^+ G! j% ~* Y6 y int unhighlight = 0;
0 [; O" j$ }2 N6 b UF_CURVE_line_p_t line_coords; _# w; @# q' P; a$ K' j
tag_t line_tag;9 N4 _ t; X/ q/ F1 U3 r- R
opts.other_options = 0;
) [7 E2 v' ^( P3 J7 u( E opts.reserved = NULL;+ x* y) Z. z/ K* |- A
opts.num_mask_triples = 1;
5 y% f f" }% L/ b/ _! D- H8 k; k opts.mask_triples = mask;
3 _9 j9 c7 Q! Q, ?3 C opts.scope = UF_UI_SEL_SCOPE_WORK_PART_AND_OCC; // 定义选择范围
( d3 }: C9 N1 _$ ]+ a err = UF_UI_select_single(message, &opts, &response, &object, cursor, &view);: g! _! p; T, G, t- h
if(err == 0 && response == 4 || response == 5)
/ Q9 y+ D' u4 V8 ?1 M E {- s" o& e/ L% R. `( ? K# @
if(object != NULL_TAG), a) }: ~( U7 f% ~* I. C
{ ( L" U! f, e- n7 h
/*extern UFUNEXPORT int UF_CURVE_ask_line_data(tag_t line ,UF_CURVE_line_p_t line_coords)*/ 0 G K( {3 f+ X; o; ?. j
UF_CURVE_ask_line_data (object, line_coords); // 获取点位置
: c4 n) a5 ]& y9 r //---下面要取出端点 再把端点偏置 但是代码不知道怎么实现了 ------请高人进来!!!!!! q6 i+ j; }- J/ T" [: g
A[0]= line_coords->start_point[0];; u! |" w4 f: w2 e% ?
A[1]= line_coords->start_point[1];+ I9 p4 x) B% ?3 S
A[2]= line_coords->start_point[2];
0 J2 d- y# ]. t- [; G0 B* }: Y //uc1601(info,1); # }5 }9 [: o$ s9 W& X8 y
}
% _1 m% l) d3 V' q, S // UF_CURVE_create_line(&line_coords,&line_tag);$ O% r S/ J5 F1 _# V
}1 _, R6 Y, f1 U& r0 L& f
UF_terminate ();
1 S' h2 W& ^/ U /* Callback acknowledged, do not terminate dialog */
0 d4 p" p# q& X4 M: i+ r& @ return (UF_UI_CB_CONTINUE_DIALOG); , T0 [( M5 k( \8 r8 v' N9 `
} |
|