Skip to content

Commit

Permalink
working around #606
Browse files Browse the repository at this point in the history
no Miller.dispStyle can be either character or enumeration
enforcing variable type is only supported starting with Matlab 2019b
so MTEX should not depend on it
however in the case of MillerConvention it makes the code much easier hence we should take back this commit one we can assume everybody has at least Matlab 2019b
  • Loading branch information
ralfHielscher committed Dec 7, 2020
1 parent 22832e1 commit 2094f05
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion geometry/@Miller/cat.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
error('I can not store Miller indices with respect to different crystal symmetries within one list');
end

if ms.dispStyle ~= m.dispStyle
if MillerConvention(ms.dispStyle) ~= MillerConvention(m.dispStyle)
warning(['Miller indices are converted to ' char(m.dispStyle)]);
end
end
Expand Down
3 changes: 2 additions & 1 deletion geometry/@Miller/char.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
format = get_flag(varargin,{'hkl','hkil','uvw','UVTW'});
if ~isempty(format), m.dispStyle = format; end

[leftBracket, rightBracket] = m.dispStyle.brackets;

[leftBracket, rightBracket] = brackets(MillerConvention(m.dispStyle));

abc = m.coordinates;

Expand Down
2 changes: 1 addition & 1 deletion geometry/@Miller/cross.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
m = cross@vector3d(m1,m2);

% switch from recirprocal to direct and vice verca
m.dispStyle = -m.dispStyle;
m.dispStyle = MillerConvention(-MillerConvention(m.dispStyle));
2 changes: 1 addition & 1 deletion geometry/@Miller/perp.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
% Output
% n - @Miller

m = Miller(perp@vector3d(m),m.CS,-m.dispStyle);
m = Miller(perp@vector3d(m),m.CS,MillerConvention(-MillerConvention(m.dispStyle)));

end
2 changes: 1 addition & 1 deletion geometry/@orientation/round2Miller.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
hkl = round(hkl,varargin{:});

uvw = mori \ vector3d.X;
uvw.dispStyle = -uvw.dispStyle; % direct lattice
uvw.dispStyle = MillerConvention(-MillerConvention(uvw.dispStyle)); % direct lattice
uvw = round(uvw);

if nargout == 0
Expand Down
6 changes: 4 additions & 2 deletions plotting/sphericalPlot.m
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,12 @@ function plotLabels(sP,CS,varargin)
h = Miller(unique(h),CS);

% try direct coordinates
h.dispStyle = abs(h.dispStyle);
h.dispStyle = MillerConvention(abs(MillerConvention(h.dispStyle)));

% if this gives no integer values - go to reciprocal coordinates
if any(angle(round(h),h)>1e-5), h.dispStyle = -h.dispStyle; end
if any(angle(round(h),h)>1e-5)
h.dispStyle = MillerConvention(-MillerConvention(h.dispStyle));
end
h = round(h);
end

Expand Down

0 comments on commit 2094f05

Please sign in to comment.