Changeset 212 for trunk/src/set_object.m
 Timestamp:
 Mar 2, 2011, 10:45:33 PM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/set_object.m
r206 r212 210 210 end 211 211 end 212 if isfield(data,'Phi') 213 if ~ischar(handles.Phi) 214 data.DY=num2str(data.Phi,3); 215 end 216 set(handles.Phi,'String',data.Phi) 217 end 218 if isfield(data,'Theta') 219 if ~ischar(handles.Theta) 220 data.DY=num2str(data.Theta,3); 221 end 222 set(handles.Theta,'String',data.Theta) 223 end 224 if isfield(data,'Psi') 225 if ~ischar(handles.Psi) 226 data.DY=num2str(data.Psi,3); 227 end 228 set(handles.Psi,'String',data.Psi) 229 end 212 if isfield(data,'Angle') && isequal(numel(data.Angle),3) 213 set(handles.Phi,'String',num2str(data.Angle(1))) 214 set(handles.Theta,'String',num2str(data.Angle(2))) 215 set(handles.Psi,'String',num2str(data.Angle(3))) 216 end 230 217 if isfield(data,'DZ') 231 218 if ~ischar(handles.DZ) … … 402 389 set(handles.YObject,'TooltipString',['YObject: y coordinate of the ' ObjectStyle ' centre']) 403 390 case {'plane'} 404 set(handles.P hi,'Visible','on')391 set(handles.Psi,'Visible','on') 405 392 set(handles.XMin,'Visible','on') 406 393 set(handles.XMax,'Visible','on') … … 412 399 if test3D 413 400 set(handles.Theta,'Visible','on') 414 set(handles.P si,'Visible','on')401 set(handles.Phi,'Visible','on') 415 402 set(handles.ZMax,'Visible','on') 416 403 end … … 426 413 end 427 414 case {'volume'} 428 set(handles.Phi,'Visible','on')429 415 set(handles.XMin,'Visible','on') 430 416 set(handles.XMax,'Visible','on') … … 433 419 set(handles.XObject,'TooltipString',['XObject: x coordinate of the axis origin for the ' ObjectStyle]) 434 420 set(handles.YObject,'TooltipString',['YObject: y coordinate of the axis origin for the ' ObjectStyle]) 435 % if test3D 436 set(handles.Theta,'Visible','on') 437 set(handles.Psi,'Visible','on') 438 set(handles.ZMin,'Visible','on') 439 set(handles.ZMax,'Visible','on') 440 % end 421 set(handles.Phi,'Visible','on') 422 set(handles.Theta,'Visible','on') 423 set(handles.Psi,'Visible','on') 424 set(handles.ZMin,'Visible','on') 425 set(handles.ZMax,'Visible','on') 441 426 if isequal(ProjMode,'interp') isequal(ProjMode,'filter') 442 427 set(handles.DX,'Visible','on') … … 461 446 function update_slider(hObject, eventdata,handles) 462 447 %rotation angles 463 Phi=(pi/180)*str2num(get(handles.Phi,'String'));%first Euler angle in radian 464 Theta=(pi/180)*str2num(get(handles.Theta,'String'));%second Euler angle in radian 465 466 %components of the unitiy vector normal to the projection plane 467 NormVec_X=sin(Phi)*sin(Theta); 468 NormVec_Y=cos(Phi)*sin(Theta); 469 NormVec_Z=cos(Theta); 448 PlaneAngle(1)=str2num(get(handles.Phi,'String'));%first angle in degrees 449 PlaneAngle(2)=str2num(get(handles.Theta,'String'));%second angle in degrees 450 PlaneAngle(3)=str2num(get(handles.Psi,'String'));%second angle in degrees 451 om=norm(PlaneAngle);%norm of rotation angle in radians 452 OmAxis=PlaneAngle/om; %unit vector marking the rotation axis 453 cos_om=cos(pi*om/180); 454 sin_om=sin(pi*om/180); 455 coeff=OmAxis(3)*(1cos_om); 456 %components of the unity vector norm_plane normal to the projection plane 457 norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om; 458 norm_plane(2)=OmAxis(2)*coeffOmAxis(1)*sin_om; 459 norm_plane(3)=OmAxis(3)*coeff+cos_om; 470 460 huvmat=findobj('Tag','uvmat');%find the current uvmat interface handle 471 461 UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface 472 462 if isfield(UvData,'X') & isfield(UvData,'Y') & isfield(UvData,'Z') 473 Z= NormVec_X *(UvData.X)+NormVec_Y *(UvData.Y)+NormVec_Z*(UvData.Z);463 Z=norm_plane(1)*(UvData.X)+norm_plane(2)*(UvData.Y)+norm_plane(3)*(UvData.Z); 474 464 set(handles.z_slider,'Min',min(Z)) 475 465 set(handles.z_slider,'Max',max(Z)) … … 620 610 end 621 611 if isfield(s,'Phi') 622 set(handles.Phi,'String',s.Phi) 623 end 624 if isfield(s,'Theta') 625 set(handles.Theta,'String',s.Theta) 626 end 627 if isfield(s,'Psi') 628 set(handles.Psi,'String',s.Psi) 629 end 612 set(handles.Psi,'String',s.Phi)%old definition 613 end 614 if isfield(s,'Angle')&& isequal(numel(s.Angle),3) 615 set(handles.Phi,'String',s.Angle(1)) 616 set(handles.Theta,'String',s.Angle(2)) 617 set(handles.Psi,'String',s.Angle(3)) 618 end 619 % if isfield(s,'Psi') 620 % set(handles.Psi,'String',s.Psi) 621 % end 630 622 631 623 if isfield(s,'DX') … … 860 852 function z_slider_Callback(hObject, eventdata, handles) 861 853 % 862 %A ADAPTER863 854 Z_value=get(handles.z_slider,'Value'); 864 865 855 %rotation angles 866 Phi=(pi/180)*str2num(get(handles.Phi,'String'));%first Euler angle in radian 867 Theta=(pi/180)*str2num(get(handles.Theta,'String'));%second Euler angle in radian 868 869 %components of the unity vector normal to the projection plane 870 NormVec_X=sin(Phi)*sin(Theta); 871 NormVec_Y=cos(Phi)*sin(Theta); 872 NormVec_Z=cos(Theta); 856 PlaneAngle(1)=str2num(get(handles.Phi,'String'));%first angle in degrees 857 PlaneAngle(2)=str2num(get(handles.Theta,'String'));%second angle in degrees 858 PlaneAngle(3)=str2num(get(handles.Psi,'String'));%second angle in degrees 859 om=norm(PlaneAngle);%norm of rotation angle in radians 860 OmAxis=PlaneAngle/om; %unit vector marking the rotation axis 861 cos_om=cos(pi*om/180); 862 sin_om=sin(pi*om/180); 863 coeff=OmAxis(3)*(1cos_om); 864 %components of the unity vector norm_plane normal to the projection plane 865 norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om; 866 norm_plane(2)=OmAxis(2)*coeffOmAxis(1)*sin_om; 867 norm_plane(3)=OmAxis(3)*coeff+cos_om; 873 868 874 869 %set new plane position and update graph 875 set(handles.XObject,'String',num2str( NormVec_X*Z_value,4))876 set(handles.YObject,'String',num2str( NormVec_Y*Z_value,4))877 set(handles.ZObject,'String',num2str( NormVec_Z*Z_value,4))870 set(handles.XObject,'String',num2str(norm_plane(1)*Z_value,4)) 871 set(handles.YObject,'String',num2str(norm_plane(2)*Z_value,4)) 872 set(handles.ZObject,'String',num2str(norm_plane(3)*Z_value,4)) 878 873 PLOT_Callback(hObject, eventdata, handles) 879 874 %
Note: See TracChangeset
for help on using the changeset viewer.