Changeset 966
- Timestamp:
- Jul 9, 2016, 10:02:57 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mouse_down.m
r955 r966 436 436 Delta_x=(xy(1,1)-ObjectData.Coord(1,1));%displacement along x 437 437 Delta_y=(xy(1,2)-ObjectData.Coord(1,2));%displacement along y 438 Delta_mod=sqrt(Delta_x*Delta_x+Delta_y*Delta_y);%modulus of displacement 439 ObjectData.Angle(1)=90*Delta_x/Delta_mod; 440 ObjectData.Angle(2)=90*Delta_y/Delta_mod; 441 ObjectData.Angle(3)=0;% plane rotated by 90 ° along the axis of mouse displacement since the origin 438 ObjectData.Angle(1)=(180/pi)*angle(Delta_x+i*Delta_y); 439 ObjectData.Angle(2)=90; 442 440 set(hh_set_object.num_Angle_1,'String',num2str(ObjectData.Angle(1))) 443 441 set(hh_set_object.num_Angle_2,'String',num2str(ObjectData.Angle(2))) 444 set(hh_set_object.num_Angle_3,'String',num2str(ObjectData.Angle(3)))445 442 drawing_status='off'; 446 443 else -
trunk/src/mouse_motion.m
r954 r966 377 377 return 378 378 end 379 if numel(UvData.ProjObject)<PlotData.IndexObj 380 return 381 end 379 382 ObjectData=UvData.ProjObject{PlotData.IndexObj}; 380 383 if isequal(hObject,huvmat)% if the mouse ifs over the GUI uvmat 384 if numel(UvData.ProjObject)<get(hhuvmat.ListObject_1,'Value') 385 return 386 end 381 387 ProjObject=UvData.ProjObject{get(hhuvmat.ListObject_1,'Value')}; 382 388 else 389 if numel(UvData.ProjObject)<get(hhuvmat.ListObject,'Value') 390 return 391 end 383 392 ProjObject=UvData.ProjObject{get(hhuvmat.ListObject,'Value')}; 384 393 end -
trunk/src/plot_object.m
r955 r966 152 152 case {'plane','plane_z','volume'} 153 153 if ~isfield(ObjectData,'Angle') 154 ObjectData.Angle=[0 0 0]; 155 end 156 if strcmp(ObjectData.Type,'plane_z') 157 Angle_1=ObjectData.Angle(1); 158 Angle_2=ObjectData.Angle(2); 159 norm_angle=sqrt(Angle_1*Angle_1+Angle_2*Angle_2); 160 cosphi=Angle_1/norm_angle;%angle in radians 161 sinphi=Angle_2/norm_angle;%angle in radians 162 else 163 cosphi=cos(ObjectData.Angle(3)*pi/180);%angle in radians 164 sinphi=sin(ObjectData.Angle(3)*pi/180);%angle in radians 165 end 154 ObjectData.Angle=[0 0]; 155 end 156 cosphi=cos(ObjectData.Angle(1)*pi/180);%angle in radians 157 sinphi=sin(ObjectData.Angle(1)*pi/180);%angle in radians 166 158 x0=xline(1); y0=yline(1); 167 159 xlim=get(haxes,'XLim'); -
trunk/src/proj_field.m
r965 r966 552 552 return 553 553 end 554 CellInfo=CellInfo(NbDim ==2); %keep only the 2D cells554 CellInfo=CellInfo(NbDim>=2); %keep only the 2D cells 555 555 %%%%%% TODO: treat 1D fields: project as identity so that P o P=P for projection operation 556 556 cell_select=true(size(CellInfo)); … … 676 676 VarIndex=find(check_proj);% indices of the variables to be projected 677 677 678 %% identify vector components679 %testU=isfield(CellInfo{icell},'VarIndex_vector_x') &&isfield(CellInfo{icell},'VarIndex_vector_y') ;% test for vectors680 % if testU681 % UName=FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x};682 % VName=FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y};683 % vector_x=FieldData.(UName);684 % vector_y=FieldData.(VName);685 % end686 678 %identify error flag 687 679 errorflag=0; %default, no error flag … … 701 693 %case of unstructured coordinates 702 694 case 'scattered' 703 % XName= FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};704 % YName= FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};695 % XName= FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)}; 696 % YName= FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)}; 705 697 coord_x=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)}); 706 698 coord_y=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)}); … … 813 805 case 'grid' %case of structured coordinates 814 806 if ~isequal(ObjectData.Type,'line')% exclude polyline 815 errormsg=['no projection available on ' ObjectData.Type 'for structured coordinates']; % 807 errormsg=['no projection available on ' ObjectData.Type 'for structured coordinates']; 808 return 809 end% 810 test_interp2=0;%default 811 AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)}; 812 AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)}; 813 AX=FieldData.(AXName);% set of x positions 814 AY=FieldData.(AYName);% set of y positions 815 AName=FieldData.ListVarName{VarIndex(1)}; 816 npxy=size(FieldData.(AName)); 817 if max(NbDim)==3 % 3D case 818 816 819 else 817 test_Amat=1;%image or 2D matrix818 test_interp2=0;%default819 AYName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end-1)};820 AXName=FieldData.ListVarName{CellInfo{icell}.CoordIndex(end)};821 eval(['AX=FieldData.' AXName ';']);% set of x positions822 eval(['AY=FieldData.' AYName ';']);% set of y positions823 AName=FieldData.ListVarName{VarIndex(1)};824 eval(['A=FieldData.' AName ';']);% scalar825 npxy=size(A);826 820 npx=npxy(2); 827 821 npy=npxy(1); … … 921 915 end 922 916 end 923 if ~isempty(ivar_U) && ~isempty(ivar_V) 924 vector_x =ProjData.(ProjData.ListVarName{ivar_U}); 925 ProjData.(ProjData.ListVarName{ivar_U}) =cos(theta)*vector_x+sin(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 926 ProjData.(ProjData.ListVarName{ivar_V}) =-sin(theta)*vector_x+cos(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 927 end 917 end 918 if ~isempty(ivar_U) && ~isempty(ivar_V) 919 vector_x =ProjData.(ProjData.ListVarName{ivar_U}); 920 ProjData.(ProjData.ListVarName{ivar_U}) =cos(theta)*vector_x+sin(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 921 ProjData.(ProjData.ListVarName{ivar_V}) =-sin(theta)*vector_x+cos(theta)*ProjData.(ProjData.ListVarName{ivar_V}); 922 end 928 923 end 929 924 … … 961 956 % ObjectData.Angle=[0 0 0]; 962 957 % ObjectData.Angle(1)=90*Delta_x/Delta_mod; 963 % ObjectData. Angle(2)=90*Delta_y/Delta_mod;958 % ObjectData.0(2)=90*Delta_y/Delta_mod; 964 959 % end 965 960 if isfield(ObjectData,'Angle')&& isequal(size(ObjectData.Angle),[1 2])&& ~isequal(ObjectData.Angle,[0 0]) 966 961 test90y=0;%isequal(ObjectData.Angle,[0 90 0]); 967 962 PlaneAngle=(pi/180)*ObjectData.Angle; 968 % om=norm(PlaneAngle);%norm of rotation angle in radians969 % OmAxis=PlaneAngle/om; %unit vector marking the rotation axis970 % cos_om=cos(om);971 % sin_om=sin(om);972 % coeff=OmAxis(3)*(1-cos_om);973 % %components of the unity vector norm_plane normal to the projection plane974 % norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om;975 % norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om;976 % norm_plane(3)=OmAxis(3)*coeff+cos_om;963 % om=norm(PlaneAngle);%norm of rotation angle in radians 964 % OmAxis=PlaneAngle/om; %unit vector marking the rotation axis 965 % cos_om=cos(om); 966 % sin_om=sin(om); 967 % coeff=OmAxis(3)*(1-cos_om); 968 % %components of the unity vector norm_plane normal to the projection plane 969 % norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om; 970 % norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om; 971 % norm_plane(3)=OmAxis(3)*coeff+cos_om; 977 972 978 M2=[cos(PlaneAngle(2)) sin(PlaneAngle(2)) 0;-sin(PlaneAngle(2)) cos(PlaneAngle(2)) 0;0 0 1];979 M1=[1 0 0;0 cos(PlaneAngle(1)) sin(PlaneAngle(1));0 -sin(PlaneAngle(1)) cos(PlaneAngle(1))];980 M=M1*M2; 981 norm_plane=M*[0 0 1]';973 M1=[cos(PlaneAngle(1)) sin(PlaneAngle(1)) 0;-sin(PlaneAngle(1)) cos(PlaneAngle(1)) 0;0 0 1]; 974 M2=[1 0 0;0 cos(PlaneAngle(2)) sin(PlaneAngle(2));0 -sin(PlaneAngle(2)) cos(PlaneAngle(2))]; 975 M=M2*M1;% first rotate in the x,y plane with angle PlaneAngle(1), then slant around the new x axis0 with angle PlaneAngle(2) 976 norm_plane=M*[0 0 1]'; 982 977 983 978 end … … 1648 1643 % determine the boundaries of the projected field, 1649 1644 % first find the 8 summits of the initial volume in the 1650 Angle=ObjectData.Angle*pi/180;1645 PlaneAngle=ObjectData.Angle*pi/180; 1651 1646 % new coordinates 1652 1647 Coord{1}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)});%initial z coordinates … … 1660 1655 %Mrot_inv=rodrigues(-PlaneAngle); 1661 1656 newsummit=zeros(3,8);% initialize the rotated summit coordinates 1662 ObjectData.Coord=ObjectData.Coord'; 1663 if size(ObjectData.Coord, 2)<31657 ObjectData.Coord=ObjectData.Coord';% set ObjectData.Coord as a vertical vector 1658 if size(ObjectData.Coord,1)<3 1664 1659 ObjectData.Coord=[ObjectData.Coord; 0];%add z origin at z=0 by default 1665 1660 end 1666 M2=[cos(Angle(2)) sin(Angle(2)) 0;-sin(Angle(2)) cos(Angle(2)) 0;0 0 1]; 1667 M1=[1 0 0;0 cos(Angle(1)) sin(Angle(1));0 -sin(Angle(1)) cos(Angle(1))]; 1668 M=M1*M2; 1661 1662 M1=[cos(PlaneAngle(1)) sin(PlaneAngle(1)) 0;-sin(PlaneAngle(1)) cos(PlaneAngle(1)) 0;0 0 1]; 1663 M2=[1 0 0;0 cos(PlaneAngle(2)) sin(PlaneAngle(2));0 -sin(PlaneAngle(2)) cos(PlaneAngle(2))]; 1664 M=M2*M1; 1669 1665 M_inv=inv(M); 1670 1666 -
trunk/src/set_object.m
r965 r966 38 38 function varargout = set_object(varargin) 39 39 40 % Last Modified by GUIDE v2.5 16-Jun-2015 00:33:5940 % Last Modified by GUIDE v2.5 09-Jul-2016 20:25:37 41 41 42 42 % Begin initialization code - DO NOT REFRESH … … 818 818 819 819 function num_RangeInterp_Callback(hObject, eventdata, handles) 820 821 822 % --- Executes on key press with focus on num_Angle_1 and none of its controls. 823 function num_Angle_1_KeyPressFcn(hObject, eventdata, handles) 824 % hObject handle to num_Angle_1 (see GCBO) 825 % eventdata structure with the following fields (see MATLAB.UI.CONTROL.UICONTROL) 826 % Key: name of the key that was pressed, in lower case 827 % Character: character interpretation of the key(s) that was pressed 828 % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed 829 % handles structure with handles and user data (see GUIDATA) 830 831 832 % --- Executes on key press with focus on num_Angle_2 and none of its controls. 833 function num_Angle_2_KeyPressFcn(hObject, eventdata, handles) 834 % hObject handle to num_Angle_2 (see GCBO) 835 % eventdata structure with the following fields (see MATLAB.UI.CONTROL.UICONTROL) 836 % Key: name of the key that was pressed, in lower case 837 % Character: character interpretation of the key(s) that was pressed 838 % Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed 839 % handles structure with handles and user data (see GUIDATA) -
trunk/src/uvmat.m
r965 r966 991 991 data.RangeY=UvData.Field.CoordMesh; 992 992 case 'plane_z' 993 data.Angle=[ 900];993 data.Angle=[0 90]; 994 994 data.DX=UvData.Field.CoordMesh; 995 995 data.DY=UvData.Field.CoordMesh;
Note: See TracChangeset
for help on using the changeset viewer.