⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 understanding_euler_angles.m

📁 欧拉角演示
💻 M
📖 第 1 页 / 共 2 页
字号:
        end
        if strcmp(get(RotPlane(1),'Visible'),'off')==1
            rotate(RotPlane(1),Vy,CAngle*180/pi,[0 0 0])
            rotate(arc1,Vy,CAngle*180/pi,[0 0 0])
        end

               
        Anow=A2;
    case 3
        Dir=3;
        
        ca='arc3';
        
        set(eval(ca),'Visible','on')
        
        set(RotPlane(3),'FaceColor',cc,'Edgecolor',cc)
        set(RotPlane(3),'Visible','on')

        set(eval(setangle),'String',  ['  Z Axis  :  ' num2str(CAngle*180/pi)])
        
  
        set(handles.Rotate,'Enable','off')
        for i=1:CAngle*180/pi
            drawnow
            CA2=copyobj(CA1,gca);
            delete(CA1)
            rotate(CA2,Vz,1,[0 0 0])
            ARC(i,:)=copyobj(eval(ca),gca);    
            rotate(ARC(i,:),Vz,i,[0 0 0])
            CA1=copyobj(CA2,gca);
            delete(CA2)  
        end

        delete( eval(ca) )
        set(handles.Rotate,'Enable','on')  

        set(ARC,'FaceColor',cc)
        delete(CA1)
        
        rotate(eval(CA),Vz,CAngle*180/pi,[0 0 0])
        
        if strcmp(get(RotPlane(1),'Visible'),'off')==1
            rotate(RotPlane(1),Vz,CAngle*180/pi,[0 0 0])
            rotate(arc1,Vz,CAngle*180/pi,[0 0 0])
        end
        
        if strcmp(get(RotPlane(2),'Visible'),'off')==1
            rotate(RotPlane(2),Vz,CAngle*180/pi,[0 0 0])
            rotate(arc2,Vz,CAngle*180/pi,[0 0 0])
        end
        
%         if strcmp(get(RotPlane(2),'Visible'),'off')==1
%             rotate(arc2,Vz,CAngle*180/pi,[0 0 0])
%         end
        
       
        Anow=A3;
end

switch count
   case 1
       ROT(1)=Dir;
       Vx=Anow*[1;0;0];        
       Vy=Anow*[0;1;0];
       Vz=Anow*[0;0;1];
       set(CoAxes1,'Visible','on')
       set(handles.Set1,'Value',1)
       set(handles.Set1,'Enable','on')
       
   case 2
       ROT(2)=Dir;
       set(CoAxes2,'Visible','on')
       set(handles.Set2,'Value',1)
       set(handles.Set2,'Enable','on')
       
       Vx=Aprev*Anow*[1;0;0];        
       Vy=Aprev*Anow*[0;1;0];
       Vz=Aprev*Anow*[0;0;1];  
   case 3
       ROT(3)=Dir;
       set(CoAxes3,'Visible','on')
       set(handles.Set3,'Value',1) 
       set(handles.Set3,'Enable','on')
       set(handles.Rotate,'Enable','off')
%        Vx=Aprev*Anow*[1;0;0];        
%        Vy=Aprev*Anow*[0;1;0];
%        Vz=Aprev*Anow*[0;0;1];  % But Not needed Since the rotation is
%        over and no more transformation is neede.
end

Aprev=Anow;

if count==1
    ARC1=copyobj(ARC,gca);
    delete(ARC)
    set(handles.POR1,'Enable','on')
    set(handles.PAR1,'Enable','on')
elseif count==2
    ARC2=copyobj(ARC,gca);
    delete(ARC)
    set(handles.POR2,'Enable','on')
    set(handles.PAR2,'Enable','on')
elseif count==3
    ARC3=copyobj(ARC,gca);
    delete(ARC)
    set(handles.POR3,'Enable','on')
    set(handles.PAR3,'Enable','on')
end

save Trans A1 A2 A3 Aprev Vx Vy Vz count ROT ARC1 ARC2 ARC3 arc1 arc2 arc3



% --- Executes on button press in RESET.
function RESET_Callback(hObject, eventdata, handles)
% hObject    handle to RESET (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
set(handles.Rotate,'Enable','on')
Understanding_Euler_Angles


% --- Executes on button press in POR1.
function POR1_Callback(hObject, eventdata, handles)
% hObject    handle to POR1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of POR1


load Trans
load Maxes
if (get(hObject,'Value') == get(hObject,'Max'))
    set(RotPlane(ROT(1)),'Visible','on')
else
    set(RotPlane(ROT(1)),'Visible','off')
end


% --- Executes on button press in POR2.
function POR2_Callback(hObject, eventdata, handles)
% hObject    handle to POR2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of POR2

load Trans
load Maxes
if (get(hObject,'Value') == get(hObject,'Max'))
    set(RotPlane(ROT(2)),'Visible','on')
else
    set(RotPlane(ROT(2)),'Visible','off')
end



% --- Executes on button press in POR3.
function POR3_Callback(hObject, eventdata, handles)
% hObject    handle to POR3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of POR3

load Trans
load Maxes
if (get(hObject,'Value') == get(hObject,'Max'))
    set(RotPlane(ROT(3)),'Visible','on')
else
    set(RotPlane(ROT(3)),'Visible','off')
end



% --- Executes on button press in Iso.
function Iso_Callback(hObject, eventdata, handles)
% hObject    handle to Iso (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
load Maxes
view([1 1 1])
camlookat(BaseSphere)
camzoom(1.5)


% --- Executes on button press in XY.
function XY_Callback(hObject, eventdata, handles)
% hObject    handle to XY (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
load Maxes
view(0,90)
camlookat(BaseSphere)
camzoom(1.3)



% --- Executes on button press in YZ.
function YZ_Callback(hObject, eventdata, handles)
% hObject    handle to YZ (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
load Maxes
view(90,0)
camlookat(BaseSphere)
camzoom(1.3)



% --- Executes on button press in ZX.
function ZX_Callback(hObject, eventdata, handles)
% hObject    handle to ZX (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
load Maxes
view(0,0)
camlookat(BaseSphere)
camzoom(1.3)

% --- Executes on button press in RotateView.
function RotateView_Callback(hObject, eventdata, handles)
% hObject    handle to RotateView (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of RotateView
load Maxes
rotate3d

function Angle1_Callback(hObject, eventdata, handles)
% hObject    handle to Angle1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Angle1 as text
%        str2double(get(hObject,'String')) returns contents of Angle1 as a double


% --- Executes during object creation, after setting all properties.
function Angle1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Angle1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


function Angle2_Callback(hObject, eventdata, handles)
% hObject    handle to Angle2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Angle2 as text
%        str2double(get(hObject,'String')) returns contents of Angle2 as a double


% --- Executes during object creation, after setting all properties.
function Angle2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Angle2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function Angle3_Callback(hObject, eventdata, handles)
% hObject    handle to Angle3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Angle3 as text
%        str2double(get(hObject,'String')) returns contents of Angle3 as a double


% --- Executes during object creation, after setting all properties.
function Angle3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Angle3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --- Executes on button press in PAR1.
function PAR1_Callback(hObject, eventdata, handles)
% hObject    handle to PAR1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of PAR1

load Trans
load Maxes
if (get(hObject,'Value') == get(hObject,'Max'))
    set(ARC1,'Visible','on')
else
    set(ARC1,'Visible','off')
end



% --- Executes on button press in PAR2.
function PAR2_Callback(hObject, eventdata, handles)
% hObject    handle to PAR2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of PAR2

load Trans
load Maxes
if (get(hObject,'Value') == get(hObject,'Max'))
    set(ARC2,'Visible','on')
else
    set(ARC2,'Visible','off')
end


% --- Executes on button press in PAR3.
function PAR3_Callback(hObject, eventdata, handles)
% hObject    handle to PAR3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of PAR3

load Trans
load Maxes
if (get(hObject,'Value') == get(hObject,'Max'))
    set(ARC3,'Visible','on')
else
    set(ARC3,'Visible','off')
end


% --- Executes on button press in Author.
function Author_Callback(hObject, eventdata, handles)
% hObject    handle to Author (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of Author

state=get(hObject,'Value');
if state==get(hObject,'Max')
    B = imread('Banner.jpg');
    set(handles.axes2,'Visible','on')
    axes(handles.axes2)
    B=image(B);
    
    save('ha','B')
%     save Banner B
%     guidata(Banner,handles)
    axis off
    axes(handles.axes1)
elseif state==get(hObject,'Min')
    load ha;
    set(B,'Visible','off')
    set(handles.axes2,'Visible','off')
    axes(handles.axes1)
    
end



function whileclosing(hObject, eventdata, handles)

clc
clear
closereq

aa=0;

save ha aa
save HANDLESFILE aa
save Maxes aa
save Trans aa

delete ha.mat HANDLESFILE.mat Maxes.mat Trans.mat

msg=['  Please Review in mathworks.com or Send your Feedbacks to author   ';...
     '                                                                    ';...
     '     j.divahar@yahoo.com / j.divahar@gmail.com                      ';...
     '                                                                    ';...
     '     HomePage: http://four.fsphost.com/jdivahar                     '];
    

button = msgbox(msg,'Thank you For Trying !');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -