旋光异构手吧 关注:31贴子:2,089
  • 2回复贴,共1

材力软件代码记录

只看楼主收藏回复

%箭头
plot([-0.4 -0.4 0.4 0.4 -0.4],[-0.4 0.4 0.4 -0.4 -0.4],'-k')
axis([-1 1 -1 1]);
axis square
% axx=[.4;.7];
% ayy=[0;0];
% [ax,ay]=dsxy2figxy(gca,axx,ayy);
% h = annotation('textarrow',ax,ay);
% set(h,'string','80MPa');


IP属地:美国1楼2014-05-21 19:26回复
    function Drag()
    %实现鼠标拖拽功能
    DragMode();
    end
    function DragMode()
    global f aH hl
    aH
    f
    a = 10
    set(aH,'ButtonDownFcn',@startDragFcn);
    set(f,'WindowButtonUpFcn',@stopDragFcn);
    a = 15
    function startDragFcn(varargin)
    %拖拽实现函数
    a = 30
    set(f,'WindowButtonMotionFcn',@draggingFcn)
    end
    function draggingFcn(varargin)
    %得到鼠标当前点坐标,计算当前点与起始点坐标之差,修改起始坐标点为二次起始点
    global bd o1 o2
    global i1 i2 i3
    global delta
    global ii4 oo6 oo7
    a = 40
    if bd == 1
    pos = get(aH,'CurrentPoint');
    %计算鼠标角度
    if pos(1,1)-((o1+o2)/2)>=0
    alpha = atan(pos(1,2)/((pos(1,1)-((o1+o2)/2))));
    elseif pos(1,2)>=0
    alpha = atan(pos(1,2)/((pos(1,1)-((o1+o2)/2))))+pi;
    else
    alpha = atan(pos(1,2)/((pos(1,1)-((o1+o2)/2))))-pi;
    end
    alpha
    %计算初始角度
    if i1-((o1+o2)/2)>=0
    startalpha = atan(i3/(i1-((o1+o2)/2)));
    elseif i3>=0
    startalpha = atan(i3/(i1-((o1+o2)/2)))+pi;
    else
    startalpha = atan(i3/(i1-((o1+o2)/2)))-pi;
    end
    %计算角度差
    delta = alpha - startalpha;
    delta = delta/2;
    end
    ii4 = delta;
    oo6 = 0.5*(i1+i2)+0.5*(i1-i2)*cos(2*ii4)-i3*sin(2*ii4);
    oo7 = 0.5*(i1-i2)*sin(2*ii4)+i3*cos(2*ii4);
    %设置直线属性
    set(hl,'XData',[(o1+o2)/2,oo6]);
    set(hl,'YData',[0,oo7]);
    % string = strcat(num2str(oo6),',',num2str(007));
    % text(oo6,oo7,string);
    end
    function stopDragFcn(varargin)
    set(f,'WindowButtonMotionFcn','');
    end
    end


    IP属地:美国2楼2014-05-25 14:27
    回复


      IP属地:美国3楼2014-05-25 21:38
      回复