From 2094f0581c8d9445a6cca9a0188150a632e8a517 Mon Sep 17 00:00:00 2001 From: Ralf Hielscher Date: Sun, 6 Dec 2020 15:45:44 +0100 Subject: [PATCH] working around #606 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 --- geometry/@Miller/cat.m | 2 +- geometry/@Miller/char.m | 3 ++- geometry/@Miller/cross.m | 2 +- geometry/@Miller/perp.m | 2 +- geometry/@orientation/round2Miller.m | 2 +- plotting/sphericalPlot.m | 6 ++++-- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/geometry/@Miller/cat.m b/geometry/@Miller/cat.m index 6069441ab..4d124bd11 100644 --- a/geometry/@Miller/cat.m +++ b/geometry/@Miller/cat.m @@ -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 diff --git a/geometry/@Miller/char.m b/geometry/@Miller/char.m index 3e4562e4d..395a71e8e 100644 --- a/geometry/@Miller/char.m +++ b/geometry/@Miller/char.m @@ -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; diff --git a/geometry/@Miller/cross.m b/geometry/@Miller/cross.m index ad14cc0d8..33665b404 100644 --- a/geometry/@Miller/cross.m +++ b/geometry/@Miller/cross.m @@ -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)); diff --git a/geometry/@Miller/perp.m b/geometry/@Miller/perp.m index cdf4fe2f3..dde37a755 100644 --- a/geometry/@Miller/perp.m +++ b/geometry/@Miller/perp.m @@ -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 diff --git a/geometry/@orientation/round2Miller.m b/geometry/@orientation/round2Miller.m index c2e7ad668..047078402 100644 --- a/geometry/@orientation/round2Miller.m +++ b/geometry/@orientation/round2Miller.m @@ -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 diff --git a/plotting/sphericalPlot.m b/plotting/sphericalPlot.m index 21efc530c..5b42a76db 100644 --- a/plotting/sphericalPlot.m +++ b/plotting/sphericalPlot.m @@ -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