1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| function ButtonMotionFcn(~,~,ind,h,myText,h_bezier) global ctrl_points h1; pt = get(gca,'CurrentPoint'); ctrl_points(:,ind) = [pt(1,1);pt(1,2)];
for i = 0:0.01:1 newData(:,int32(i*100)+1) = cqj_GetBezier3Point(ctrl_points,i); end set(h_bezier,'XData',newData(1,:)); set(h_bezier,'YData',newData(2,:)); set(h,'xdata',ctrl_points(1,:)); set(h,'ydata',ctrl_points(2,:)); set(myText(ind),'position',[pt(1,1),pt(1,2),0]); set(h1,'xdata',pt(1,1)); set(h1,'ydata',pt(1,2)); set(h1,'visible','on'); drawnow; end
|