Changeset 935 for trunk/src/proj_field.m
 Timestamp:
 Mar 28, 2016, 9:15:18 PM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/proj_field.m
r933 r935 951 951 PlaneAngle=[0 0 0]; 952 952 norm_plane=[0 0 1]; 953 cos_om=1;954 sin_om=0;953 %cos_om=1; 954 %sin_om=0; 955 955 test90x=0;%=1 for 90 degree rotation alround x axis 956 956 test90y=0;%=1 for 90 degree rotation alround y axis … … 1052 1052 ProjData.CoordMesh=FieldData.CoordMesh; 1053 1053 end 1054 error=0;%default1055 flux=0;1056 testfalse=0;1057 ListIndex={};1054 %error=0;%default 1055 %flux=0; 1056 %testfalse=0; 1057 %ListIndex={}; 1058 1058 1059 1059 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions … … 1340 1340 if strcmp(ProjMode{icell},'interp_tps') 1341 1341 Coord=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex}); 1342 1343 1344 coord_x=Coord(:,1,:);% initial x coordinates 1345 coord_y=Coord(:,2,:);% initial y coordinates 1346 check3D=(numel(CellInfo{icell}.CoordIndex)==3); 1347 if check3D 1348 coord_z=Coord(:,3,:); 1349 end 1350 1351 % translate initial coordinates to account for the new origin 1352 coord_x=coord_xObjectData.Coord(1,1); 1353 coord_y=coord_yObjectData.Coord(1,2); 1354 if check3D 1355 coord_z=coord_zObjectData.Coord(1,3); 1356 end 1357 1358 % selection of the vectors in the projection range (3D case) 1359 if check3D && width > 0 1360 %components of the unitiy vector normal to the projection plane 1361 fieldZ=norm_plane(1)*coord_x + norm_plane(2)*coord_y+ norm_plane(3)*coord_z;% distance to the plane 1362 indcut=find(abs(fieldZ) <= width); 1363 for ivar=VarIndex 1364 VarName=FieldData.ListVarName{ivar}; 1365 FieldData.(VarName)=FieldData.(VarName)(indcut); 1366 end 1367 coord_x=coord_x(indcut); 1368 coord_y=coord_y(indcut); 1369 coord_z=coord_z(indcut); 1370 end 1371 1372 %rotate coordinates if needed: coord_X,coord_Y= = coordinates in the new plane 1373 Psi=PlaneAngle(1); 1374 Theta=PlaneAngle(2); 1375 Phi=PlaneAngle(3); 1376 if testangle && ~test90y && ~test90x;%=1 for slanted plane 1377 coord_X=(coord_x *cos(Phi) + coord_y* sin(Phi)); 1378 coord_Y=(coord_x *sin(Phi) + coord_y *cos(Phi))*cos(Theta); 1379 coord_Y=coord_Y+coord_z *sin(Theta); 1380 coord_X=(coord_X *cos(Psi)  coord_Y* sin(Psi));%A VERIFIER 1381 coord_Y=(coord_X *sin(Psi) + coord_Y* cos(Psi)); 1382 else 1383 coord_X=coord_x; 1384 coord_Y=coord_y; 1385 end 1386 1387 %restriction to the range of X and Y if imposed by the projection object 1388 1389 1390 Coord(:,1,:)=coord_X;% initial x coordinates 1391 Coord(:,2,:)=coord_Y;% initial y coordinates 1392 1393 1342 1394 NbCentres=FieldData.(FieldData.ListVarName{CellInfo{icell}.NbCentres_tps}); 1343 1395 SubRange=FieldData.(FieldData.ListVarName{CellInfo{icell}.SubRange_tps});
Note: See TracChangeset
for help on using the changeset viewer.