mtex-toolbox / mtex

MTEX is a free Matlab toolbox for quantitative texture analysis. Homepage:
http://mtex-toolbox.github.io/
GNU General Public License v2.0
274 stars 182 forks source link

fix plottingConvention.m #2140

Closed vtvivian closed 1 month ago

vtvivian commented 1 month ago

I think rotation.map in set.east/north etc. needs a second vector pair to define the correct rotation

otherwise you can accidentally change the first screen direction when setting the other one in the constructor:

pC = plottingConvention(vector3d.Z,-vector3d.X)
 % pC = plottingConvention
 % 
 %  outOfScreen: (0,0,-1)
 %  north      : (0,1,0) 
 %  east       : (-1,0,0)

pC.rot
% ans = rotation
%
% Bunge Euler angles in degree
% phi1  Phi phi2
%   90  180  270

pC.outOfScreen
% ans = vector3d
%   x  y  z
%   0  0 -1
% % this is wrong

% try to set outOfScreen again
pC.outOfScreen = vector3d.Z
pC.rot
% pC = plottingConvention
% 
%   outOfScreen: (0,0,1) 
%   north      : (0,-1,0)
%   east       : (-1,0,0)
% 
% ans = rotation
% 
%   Bunge Euler angles in degree
%   phi1  Phi phi2
%    180    0    0

pC.outOfScreen
% ans = vector3d
%   x y z
%   0 0 1
% this is now correct
ralfHielscher commented 1 month ago

Hi Vivian, thank you for pointing this out. The reason I implemented it in this way, was that sometimes changing one axis requires a change of the second axis as well. I will include a try catch statement. Ralf.