Changeset 1078 for trunk/src/proj_field.m
 Timestamp:
 Mar 30, 2020, 3:48:19 PM (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/proj_field.m
r1077 r1078 985 985 986 986 % 987 %project on a plane 988 % AJOUTER flux,circul,error 987 % proj_plane: project on a plane defined by the structure ObjectData containing: 988 % .Type : = 'plane' 989 % .ProjMode (mode of projection) = 'projection''interp_lin''interp_tps' ; 990 % .CoordUnit: (for instance 'px','cm') units for the coordinates defining the plane (the program checks that it fits with the unit of the input Field) 991 % .Angle : angles of rotation of the plane expressed in degrees. The first element 992 % ObjectData.Angle(1) represents a rotation in the plane (x,y) (around the 993 % vertical axis), which can be followed by a rotation with angle ObjectData.Angle(2) around the new (rotated) x axis. 994 % .Coord(1,3): coordinates (x,y,z) of the origin of the new coordinates in the projection plane; 995 % .DX,.DY,.DZ : increments along each coordinate for the projected data (for 'interp_lin' and 'interp_tps') 996 % .RangeX,RangeY: vectors with two elements defining the lower and upper bounds of the respectively X and Y coordinates in the projection plane 997 % .RangeInterp: maximum distance of interpolation from the known data. Interpolation yields NaN beyond this distance. 998 999 % TODO: AJOUTER flux,circul,error 989 1000 function [ProjData,errormsg] = proj_plane(FieldData, ObjectData) 990 1001 % 991 1002 992 %% rotation angles1003 %% rotation matrix 993 1004 PlaneAngle=[0 0]; 994 1005 norm_plane=[0 0 1]; 995 %cos_om=1;996 %sin_om=0;997 1006 test90x=0;%=1 for 90 degree rotation alround x axis 998 1007 test90y=0;%=1 for 90 degree rotation alround y axis 999 % if strcmp(ObjectData.Type,'plane_z') 1000 % Delta_x=ObjectData.Coord(2,1)ObjectData.Coord(1,1); 1001 % Delta_y=ObjectData.Coord(2,2)ObjectData.Coord(1,2); 1002 % Delta_mod=sqrt(Delta_x*Delta_x+Delta_y*Delta_y); 1003 % ObjectData.Angle=[0 0 0]; 1004 % ObjectData.Angle(1)=90*Delta_x/Delta_mod; 1005 % ObjectData.0(2)=90*Delta_y/Delta_mod; 1006 % end 1008 1007 1009 if isfield(ObjectData,'Angle') 1008 1010 checkM2=0; … … 1014 1016 if PlaneAngle==0 1015 1017 PlaneAngle=[0 0]; 1016 end 1017 % om=norm(PlaneAngle);%norm of rotation angle in radians 1018 % OmAxis=PlaneAngle/om; %unit vector marking the rotation axis 1019 % cos_om=cos(om); 1020 % sin_om=sin(om); 1021 % coeff=OmAxis(3)*(1cos_om); 1022 % %components of the unity vector norm_plane normal to the projection plane 1023 % norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om; 1024 % norm_plane(2)=OmAxis(2)*coeffOmAxis(1)*sin_om; 1025 % norm_plane(3)=OmAxis(3)*coeff+cos_om; 1026 1018 end 1027 1019 M1=[cos(PlaneAngle(1)) sin(PlaneAngle(1)) 0;sin(PlaneAngle(1)) cos(PlaneAngle(1)) 0;0 0 1]; 1028 1020 M=M1; … … 1031 1023 M=M1*M2;% first rotate in the x,y plane with angle PlaneAngle(1), then slant around the new x axis0 with angle PlaneAngle(2) 1032 1024 end 1033 norm_plane=M*[0 0 1]'; 1034 1025 norm_plane=M*[0 0 1]'; 1035 1026 end 1036 1027 testangle=~isequal(PlaneAngle,[0 0])~isequal(ObjectData.Coord(1:2),[0 0 ]) ;% && ~test90y && ~test90x;%=1 for slanted plane … … 1425 1416 %rotate coordinates if needed: coord_X,coord_Y= = coordinates in the new plane 1426 1417 Phi=PlaneAngle(1); 1427 if testangle && ~test90y && ~test90x ;%=1 for slanted plane1418 if testangle && ~test90y && ~test90x %=1 for slanted plane 1428 1419 new_XI=XI *cos(Phi)  YI* sin(Phi)+ObjectData.Coord(1); 1429 1420 YI=XI *sin(Phi) + YI *cos(Phi)+ObjectData.Coord(2);
Note: See TracChangeset
for help on using the changeset viewer.