Changeset 227 for trunk/src/set_object.m
- Timestamp:
- Mar 31, 2011, 1:42:51 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_object.m
r215 r227 766 766 767 767 %% plot the field projected on the object and store in the corresponding figue 768 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 768 [ProjData,errormsg]= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 769 if ~isempty(errormsg) 770 msgbox_uvmat('ERROR', errormsg) 771 return 772 end 769 773 PlotParam=read_plot_param(PlotHandles); 770 774 [PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot … … 846 850 end 847 851 msgbox_uvmat('CONFIRMATION',[answer{1} ' saved']) 848 %------------------------------------------------------------------------ 852 849 853 %------------------------------------------------------------------------ 850 854 % --- Executes on slider movement. … … 853 857 Z_value=get(handles.z_slider,'Value'); 854 858 %rotation angles 855 PlaneAngle(1)=str2num(get(handles.Phi,'String'));%first angle in degrees 856 PlaneAngle(2)=str2num(get(handles.Theta,'String'));%second angle in degrees 857 PlaneAngle(3)=str2num(get(handles.Psi,'String'));%second angle in degrees 859 PlaneAngle=[0 0 0]; 860 norm_plane=[0 0 1]; 861 cos_om=1; 862 sin_om=0; 863 864 PlaneAngle(1)=str2double(get(handles.Phi,'String'));%first angle in degrees 865 PlaneAngle(2)=str2double(get(handles.Theta,'String'));%second angle in degrees 866 PlaneAngle(3)=str2double(get(handles.Psi,'String'));%second angle in degrees 867 PlaneAngle=(pi/180)*PlaneAngle; 858 868 om=norm(PlaneAngle);%norm of rotation angle in radians 859 OmAxis=PlaneAngle/om; %unit vector marking the rotation axis 860 cos_om=cos(pi*om/180); 861 sin_om=sin(pi*om/180); 862 coeff=OmAxis(3)*(1-cos_om); 863 %components of the unity vector norm_plane normal to the projection plane 864 norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om; 865 norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om; 866 norm_plane(3)=OmAxis(3)*coeff+cos_om; 869 if isequal(om,0) 870 norm_plane=[0 0 1]; 871 else 872 OmAxis=PlaneAngle/om; %unit vector marking the rotation axis 873 cos_om=cos(om); 874 sin_om=sin(om); 875 coeff=OmAxis(3)*(1-cos_om); 876 %components of the unity vector norm_plane normal to the projection plane 877 norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om; 878 norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om; 879 norm_plane(3)=OmAxis(3)*coeff+cos_om; 880 end 867 881 868 882 %set new plane position and update graph … … 871 885 set(handles.ZObject,'String',num2str(norm_plane(3)*Z_value,4)) 872 886 PLOT_Callback(hObject, eventdata, handles) 873 %------------------------------------------------------------------------ 887 874 888 %------------------------------------------------------------------------ 875 889 % --- Executes on button press in HELP. 876 890 function HELP_Callback(hObject, eventdata, handles) 891 %------------------------------------------------------------------------ 877 892 path_to_uvmat=which ('uvmat');% check the path of uvmat 878 893 pathelp=fileparts(path_to_uvmat);
Note: See TracChangeset
for help on using the changeset viewer.