Skip to content
Snippets Groups Projects
Commit e2b13e55 authored by Yoann Guilhem's avatar Yoann Guilhem Committed by Nicola Vigano
Browse files

Update SST inverse pole figure (IPF) functions (2nd commit)

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@973 4c865b51-4357-4376-afb4-474e03ccb993
parent cc4e7ccb
No related branches found
No related tags found
No related merge requests found
function cmap = gtIVPCmap(phaseid, LD, varargin)
% GTIVPCMAP Returns a color map for the specified phase and lab direction.
function cmap = gtIPFCmap(phaseid, LD, varargin)
% GTIPFCMAP Returns a color map for the specified phase and lab direction.
%
% cmap = gtIVPCmap([phaseid, LD, varargin])
% cmap = gtIPFCmap([phaseid, LD, varargin])
% ------------------------------------------------------------------------
% Makes an IVP colormap of the lab_ direction (LD) in the crystal
% Makes an IPF colormap of the lab_ direction (LD) in the crystal
% coordinates. This can be specified as a second arguement, otherwise we
% assume the z axis [0 0 1]
%
......@@ -12,7 +12,9 @@ function cmap = gtIVPCmap(phaseid, LD, varargin)
% LD = <double> Lab direction to study {[0 0 1]}
%
% OPTIONAL INPUT (varargin as a list of pairs, see parse_pv_pairs.m)
% 'save' = <bool> Save color map to cmap_phase<phaseid>.mat
% 'saturate' = <logical> Saturate colors in the SST {true}
% 'save' = <logical> Save color map to cmap_phase<phaseid>.mat
% {true}
% 'crystal_system' = <string> Legacy to set (force) the crystal system
% for old datasets
%
......@@ -20,10 +22,14 @@ function cmap = gtIVPCmap(phaseid, LD, varargin)
% cmap = <double> RGB color map, color code is the inverse
% pole figure in the SST
%
% Version 001 03-01-2013 by YGuilhem
% Renamed gtIVPCmap to gtIPFCmap, changed color saturation
%
% Version 001 15-11-2012 by YGuilhem
% Built by gathering old gtIVPcubCmap and gtIVPhexCmap functions
% Default parameters
par.saturate = true;
par.save = false;
par.crystal_system = '';
par = parse_pv_pairs(par, varargin);
......@@ -72,7 +78,7 @@ sam2crys = gtMathsRod2RotMat(r_vectors);
LDc = gtVectorLab2Cryst(LD, sam2crys);
% Get the color in the SST triangle
map = gtCrystVector2SST(LDc, par.crystal_system, symm);
map = gtCrystVector2SST(LDc, par.crystal_system, symm, saturate);
cmap = [ 0 0 0 ; map ];
......
function hf = gtIPFCmapCubicKey(N, saturate, label)
% GTIPFCMAPCUBICKEY Show inverse pole figure color space in the cubic SST
%
% hf = gtIPFCmapCubicKey([N, saturate, label])
% -------------------------------------------------------------------------
%
% OPTIONAL INPUT:
% N = <int> Number of angular steps (quality of the plot) {30}
% saturate = <logical> Saturate or not the color in the SST
% label = <logical> Draw poles label
%
% OUTPUT:
% hf = <handle> Resulting figure handle
if ~exist('N', 'var') || isempty(N)
N = 30;
elseif N < 15
warning('gtIPFCmapCubicKey:wrong_parameters', ...
'Cannot use less than 15 angular steps, so using 15 steps.');
N = 15;
end
if ~exist('saturate', 'var') || isempty(saturate)
saturate = true;
end
if ~exist('label', 'var') || isempty(label)
label = false;
end
hf = figure();
hold on;
% Work in radians
phimin = 0;
phimax = pi/4;
inc = phimax/N;
psimin = 0;
psimax = atan(sqrt(2))+inc;
chimin = 0;
chimax = pi/4;
for phi=phimin:inc:(phimax-inc) % Rotation around z-axis
for psi=psimin:inc:(psimax-inc) % Out from z-axis to vector
% For cubic colour map, we need two angles:
% - phi (around z-axis)
% - chi (around y-axis)
z = cos(psi);
x = sin(psi)*cos(phi);
chi = atan2(x, z); % in sst chi 0->pi/4
if chi > chimax + inc/2
continue;
end
ratioR = 1 - chi/chimax;
ratioB = phi/phimax;
red = ratioR;
green = (1 - ratioR) * (1 - ratioB);
blue = (1 - ratioR) * ratioB;
rgb = [red green blue];
% Ensure that we stay in [0 1]
rgb(rgb < 0) = 0;
rgb(rgb > 1) = 1;
if saturate
% To improve colours distribution
rgb = sqrt(rgb);
% Saturate colours
rgb = rgb./max(rgb);
end
% Radius distorted for stereographic proj
r_patch = tan([psi/2 (psi+inc)/2]);
[phi_patch, r_patch] = meshgrid([phi phi+inc]', r_patch);
[x_patch, y_patch] = pol2cart(phi_patch, r_patch);
patch(x_patch, y_patch, rgb, 'EdgeColor', 'none', 'Faces', [1 2 4 3]);
end
end
% Add poles and tart up like gtMakePoleFigure
set(gca, 'XTickLabel', '');
set(gca, 'YTickLabel', '');
set(gca, 'GridLineStyle', 'none');
set(gca, 'Ycolor', 'w');
set(gca, 'Xcolor', 'w');
axis equal;
set(gca, 'xlim', [-0.01 0.45]);
set(gca, 'ylim', [-0.03 0.39]);
% Add a black border around triangle
% For cubic:
% - line from [0 0 1] to [1 0 1] (phi=0)
% - arc from [1 0 1] to [1 1 1] (phi=[0 pi/4], chi=pi/4) i.e z=x
% - line from [1 1 1] to [0 0 1] (phi=pi/4)
line_phi = [0:inc:phimax phimax]';
line_points = [cos(line_phi) sin(line_phi) cos(line_phi)];
% Normalize
line_points = line_points./repmat(sqrt(sum(line_points.*line_points, 2)), 1, 3);
% Convert to polar coordinates
line_psi = acos(line_points(:, 3));
line_r = tan(line_psi/2);
% Stereographic projection x-y
[line_x, line_y] = pol2cart(line_phi, line_r);
xp = [line_x; 0; line_x(1)];
yp = [line_y; 0; line_y(1)];
plot(xp, yp, 'k-');
% Add a white patch to mask the rough outer edge of the triangle
xp = [line_x ; line_x(end) ; 0.45 ; 0.45 ; line_x(1)];
yp = [line_y ; 0.39 ; 0.39 ; 0 ; 0 ];
patch(xp, yp, 'w', 'EdgeColor', 'none');
% Add labels for the 3 corners poles
plot(0, 0, 'k*');
text(0, 0, '[001]', 'fontsize', 18, 'fontweight', 'bold', ...
'HorizontalAlignment', 'left', 'VerticalAlignment',' top');
plot(0.4142, 0, 'k*');
text(0.4142, 0, '[101]', 'fontsize', 18, 'fontweight', 'bold', ...
'HorizontalAlignment', 'right', 'VerticalAlignment', 'top');
plot(0.366, 0.366, 'k*');
text(0.366, 0.366, '[111]', 'fontsize', 18, 'fontweight', 'bold', ...
'HorizontalAlignment', 'left', 'VerticalAlignment', 'bottom');
%poles_phi = [0 0 phimax];
%poles_chi = [0 chimax chimax];
%poles_psi
%poles_r = tan(poles_psi/2);
%[poles_x, poles_y] = sph2cart(poles_phi, poles_r);
%plot(poles_x, poles_y, 'k*');
%text(poles_x(1), poles_y(1), '[001]', 'fontsize', 18, 'fontweight', 'bold', ...
% 'HorizontalAlignment', 'left', 'VerticalAlignment',' top');
%text(poles_x(2), poles_y(2), '[101]', 'fontsize', 18, 'fontweight', 'bold', ...
% 'HorizontalAlignment', 'right', 'VerticalAlignment', 'top');
%text(poles_x(3), poles_y(3), '[111]', 'fontsize', 18, 'fontweight', 'bold', ...
% 'HorizontalAlignment', 'right', 'VerticalAlignment', 'middle');
if label
uvw_poles(1).n = '[102]'; uvw_poles(1).x = 0.236; uvw_poles(1).y = 0; % 102
uvw_poles(2).n = '[112]'; uvw_poles(2).x = 0.2247; uvw_poles(2).y = 0.2247; % 112
uvw_poles(3).n = '[213]'; uvw_poles(3).x = 0.3; uvw_poles(3).y = 0.153; % 213
uvw_poles(4).n = '[212]'; uvw_poles(4).x = 0.4; uvw_poles(4).y = 0.2; % 212
%uvw_poles(5).n = '[159]'; uvw_poles(5).x = 0.2584; uvw_poles(5).y = 0.0516; % 159
plot([uvw_poles.x], [uvw_poles.y], 'k*');
for ii=1:length(uvw_poles)
text(uvw_poles(ii).x, uvw_poles(ii).y, uvw_poles(ii).n, ...
'fontsize', 18, 'fontweight', 'bold', ...
'HorizontalAlignment','left', 'VerticalAlignment','top');
end
%text(0.1213-0.04, 0.1213, '[114]')
%text(0.1583-0.04, 0.1583, '[113]')
%text(0.2247-0.04, 0.2247, '[112]')
%text(0.2808-0.04, 0.2808, '[223]')
%text(0.3052-0.045, 0.3052, '[334]')
%text(0.3845+0.01, 0.2884, '[434]')
%text(0.3901+0.01, 0.2601, '[323]')
%text(0.4000+0.01, 0.2000, '[212]')
%text(0.4077+0.01, 0.1359, '[313]')
%text(0.4105+0.01, 0.1026, '[414]')
%text(0.1231-0.02, -0.015, '[104]')
%text(0.1623-0.01, -0.015, '[103]')
%text(0.2361-0.015, -0.015, '[102]')
%text(0.3028-0.02, -0.015, '[203]')
%text(0.3333-0.01, -0.015, '[304]')
%text(0.2967+0.01, 0.1483, '[213]')
%text(0.2330+0.01, 0.1165, '[214]')
%text(0.3297+0.01, 0.1099, '[314]')
%text(0.3197+0.01, 0.2131, '[324]')
end
set(gca, 'Position', get(gca, 'OuterPosition'));
end % end of function
function hf = gtIPFCmapHexagonalKey(N, saturate)
% GTIPFCMAPHEXAGONALKEY Show inverse pole figure color space in the hexagonal SST
%
% hf = gtIPFCmapHexagonalKey([N, saturate])
% -------------------------------------------------------------------------
%
% OPTIONAL INPUT:
% N = <int> Number of angular steps (quality of the plot) {30}
% saturate = <logical> Saturate or not the color in the SST
%
% OUTPUT:
% hf = <handle> Resulting figure handle
if ~exist('N', 'var') || isempty(N)
N = 30;
elseif N < 15
warning('gtIPFCmapCubicKey:wrong_parameters', ...
'Cannot use less than 15 angular steps, so using 15 steps.');
N = 15;
end
if ~exist('saturate', 'var') || isempty(saturate)
saturate = true;
end
hf = figure();
hold on;
% Work in radians
phimin = 0;
phimax = pi/6;
inc = phimax/N;
psimin = 0;
psimax = pi/2;
for phi=phimin:inc:(phimax-inc) % Rotation around z-axis
for psi=psimin:inc:(psimax-inc) % Out from z-axis to vector
% For hexagonal colour map, we need two angles:
% - phi (around z-axis)
% - psi (from z-axis to vector)
ratioR = 1 - psi/psimax;
ratioB = phi/phimax;
red = ratioR;
green = (1 - ratioR) * (1 - ratioB);
blue = (1 - ratioR) * ratioB;
rgb = [red green blue];
% Ensure that we stay in [0 1]
rgb(rgb < 0) = 0;
rgb(rgb > 1) = 1;
if saturate
% To improve colours distribution
rgb = sqrt(rgb);
% Saturate colours
rgb = rgb./max(rgb);
end
% Radius distorted for stereographic proj
r_patch = tan([psi/2 (psi+inc)/2]);
[phi_patch, r_patch] = meshgrid([phi phi+inc]', r_patch);
[x_patch, y_patch] = pol2cart(phi_patch, r_patch);
patch(x_patch, y_patch, rgb, 'EdgeColor', 'none', 'Faces', [1 2 4 3]);
end
end
% Add poles and tart up like gtMakePoleFigure
set(gca, 'XTickLabel', '');
set(gca, 'YTickLabel', '');
set(gca, 'GridLineStyle', 'none');
set(gca, 'Ycolor', 'w');
set(gca, 'Xcolor', 'w');
axis equal;
set(gca, 'xlim', [-0.05 1.05]);
set(gca, 'ylim', [-0.06 0.56]);
% Add a black border around triangle
% For hexagonal:
% - line from [0 0 0 1] to [1 1 -2 0] (phi=0)
% - arc from [1 1 -2 0] to [0 1 -1 0] (phi=[0 pi/6], psi=pi/2)
% - line from [0 0 0 1] to [1 1 -2 0] (phi=pi/6)
line_phi = (phimin:inc:phimax)';
line_r = tan(psimax/2 * ones(size(line_phi)));
% Stereographic projection x-y
[line_x, line_y] = pol2cart(line_phi, line_r);
xp = [line_x; 0; line_x(1)];
yp = [line_y; 0; line_y(1)];
plot(xp, yp, 'k-');
% Add labels for the 3 corners poles
poles_psi = [psimin psimax psimax];
poles_phi = [phimin phimax phimin];
poles_r = tan(poles_psi/2);
[poles_x,poles_y] = pol2cart(poles_phi, poles_r);
plot(poles_x, poles_y, 'k*');
text(poles_x(1), poles_y(1), '[0 0 0 1]', 'fontsize', 20, ...
'fontweight', 'bold','VerticalAlignment','top','HorizontalAlignment','left');
text(poles_x(2), poles_y(2), '[0 1 -1 0]', 'fontsize', 20, ...
'fontweight', 'bold','VerticalAlignment','bottom','HorizontalAlignment','right');
text(poles_x(3), poles_y(3), '[1 1 -2 0]', 'fontsize', 20, ...
'fontweight', 'bold','VerticalAlignment','top','HorizontalAlignment','right');
set(gca, 'Position', get(gca, 'OuterPosition'));
end % end of function
function hf = gtIVPhexCmap_key()
% make a color space for the reduced color space for a hexagonal system
%
% for the moment, something quick to produce a figure.
%analyse the pole data
%%%disp('WARNING - IMPORTANT')
%%%disp('this current returns green=[01-10], blue=[11-20]')
%%%disp('this is the "wrong" way round!')
%%% this has now been corrected !!!
%%% to the best of my understanding, blue=(psi/90)*(phi-60)/30 is good.
hf = figure();
hold on
i=1;j=1;
% work in degrees
inc=0.5;
phimin=60;
phimax=90;
psimin=0;
psimax=90;
for phi=[phimin:inc:(phimax-inc) (phimax-inc)] %around z-axis
j=1;
for psi=[psimin:inc:(psimax+inc) psimax+inc] % out from z-axis - go slightly further to avoid gaps at edge of triangle
% for hexagonal colour map need only psi and phi
red=(90-psi)/90;
green=(psi/90)*(90-phi)/30;
blue=(psi/90)*(phi-60)/30;
rgb=[red green blue];
% ensure that we don't leave 0-1
rgb(find(rgb<0))=0;
rgb(find(rgb>1))=1;
%do we saturate colours?
if 1
rgb=rgb./(max(rgb));
end
%radius distorted for stereographic proj
r_patch=tand([psi/2 (psi+inc)/2]);
[phi_patch,r_patch]=meshgrid([phi phi+inc]',r_patch);
% to use pol2cartphi should be in radians
% also offset by 90 degrees to get triangle "horizontal"
[x_patch,y_patch]=pol2cart((-pi/2)+phi_patch*pi/180, r_patch);
p=patch(x_patch([1 2 4 3]), y_patch([1 2 4 3]), rgb);
set(p, 'edgecolor', 'none')
j=j+1;
end
i=i+1;
end
axis ij
axis equal
%add poles and tart up like gtMakePoleFigure
set(gca, 'XTickLabel','')
set(gca, 'YTickLabel','')
set(gca, 'GridLineStyle','none')
set(gca, 'Ycolor', 'w')
set(gca, 'Xcolor', 'w')
set(gca, 'xlim', [-0.04 1.12])
set(gca, 'ylim', [-0.56 0.1])
%
% uvw_poles=[0 0 1; 1 0 1; 1 1 1; 1 1 2; 2 1 3];
% % uvw_poles=[0 0 1; 1 0 1; 1 1 1;...
% % 2 0 1; 2 1 1; 2 2 1;...
% % 3 0 1; 3 1 1; 3 2 0; 3 2 1; 3 2 2; 3 3 1; 3 3 2;...
% % 4 0 1; 4 1 1; 4 2 1; 4 3 0; 4 3 1; 4 3 2; 4 3 3; 4 4 1; 4 4 3];
%
% symm = gtCrystGetSymmetryOperators('cubic');
% uvw_poles2=[];
% for i=1:length(symm)
% uvw_poles2=[uvw_poles2; uvw_poles*symm(i).g];
% end
% uvw_poles=[uvw_poles2; -uvw_poles2];
% dum=find(uvw_poles(:,2)>=0 & uvw_poles(:,2)<=uvw_poles(:,1) & uvw_poles(:,3)>=uvw_poles(:,1));
% uvw_poles=uvw_poles(dum, :);
%
% % plot these uvw/hkl poles
% phi_uvw=atan2(uvw_poles(:,2), uvw_poles(:,1));
% psi_uvw=acos(uvw_poles(:,3)./(sqrt(sum(uvw_poles.*uvw_poles, 2))));
% r_uvw=tan(psi_uvw/2);
% dummy=find(r_uvw>1);
% r_uvw(dummy)=[];
% phi_uvw(dummy)=[];
% [x_uvw,y_uvw]=pol2cart(phi_uvw, r_uvw);
% dummy=find(x_uvw<-1 | x_uvw>1 | y_uvw<-1 | y_uvw>1);
% x_uvw(dummy)=[];
% y_uvw(dummy)=[];
%
% plot(x_uvw, y_uvw, 'k*')
%
%
% text(0, 0-0.015, '(001)')
% text(0.366+0.01, 0.366-0.005, '(111)')
% text(0.4142-0.015, -0.015, '(101)')
% text(0.2247-0.04, 0.2247, '(112)')
% text(0.3, 0.153, '(213)')
%
%
% % text(0.1213-0.04, 0.1213, '(114)')
% % text(0.1583-0.04, 0.1583, '(113)')
% % text(0.2247-0.04, 0.2247, '(112)')
% % text(0.2808-0.04, 0.2808, '(223)')
% % text(0.3052-0.045, 0.3052, '(334)')
% %
% % text(0.3845+0.01, 0.2884, '(434)')
% % text(0.3901+0.01, 0.2601, '(323)')
% % text(0.4000+0.01, 0.2000, '(212)')
% % text(0.4077+0.01, 0.1359, '(313)')
% % text(0.4105+0.01, 0.1026, '(414)')
% %
% % text(0.1231-0.02, -0.015, '(104)')
% % text(0.1623-0.01, -0.015, '(103)')
% % text(0.2361-0.015, -0.015, '(102)')
% % text(0.3028-0.02, -0.015, '(203)')
% % text(0.3333-0.01, -0.015, '(304)')
% %
% % text(0.2967+0.01, 0.1483, '(213)')
% % text(0.2330+0.01, 0.1165, '(214)')
% % text(0.3297+0.01, 0.1099, '(314)')
% % text(0.3197+0.01, 0.2131, '(324)')
%add a black border
% line 0001 - 01-10 (phi 90)
line_psi=0:1:90;
line_phi=90*ones(size(line_psi));
line_r=tand(line_psi/2);
[line_x,line_y]=pol2cart((-pi/2)+line_phi*pi/180, line_r);
plot(line_x, line_y, 'k-')
% line 0001 - 11-20 (phi 60)
line_psi=0:1:90;
line_phi=60*ones(size(line_psi));
line_r=tand(line_psi/2);
[line_x,line_y]=pol2cart((-pi/2)+line_phi*pi/180, line_r);
plot(line_x, line_y, 'k-')
% line 01-10 - 11-20 (phi 60-90, psi 90)
%add a white patch to mask the rough outer edge of the triangle
line_phi=60:0.5:90;
line_psi=90*ones(size(line_phi));
line_r=tand(line_psi/2);
[line_x,line_y]=pol2cart((-pi/2)+line_phi*pi/180, line_r);
xp=[line_x 1.02 1.02 line_x(1) line_x(1)];
yp=[line_y 0 -0.52 -0.52 line_y(1)];
p=patch(xp, yp, 'w');
set(p, 'edgecolor', 'w')
plot(line_x, line_y, 'k-')
% add labels for the poles
uvtw_poles = [0 0 0 1; 0 1 -1 0; 1 1 -2 0];
poles_psi=[0 90 90];
poles_phi=[0 90 60];
poles_r=tand(poles_psi/2);
[poles_x,poles_y]=pol2cart((-pi/2)+poles_phi*pi/180, poles_r);
plot(poles_x, poles_y, 'k*')
text(poles_x(1), poles_y(1), '[0 0 0 1]', 'fontsize', 20, ...
'fontweight', 'bold','VerticalAlignment','top','HorizontalAlignment','left')
text(poles_x(2), poles_y(2), '[0 1 -1 0]', 'fontsize', 20, ...
'fontweight', 'bold','VerticalAlignment','top','HorizontalAlignment','right')
text(poles_x(3), poles_y(3), '[1 1 -2 0]', 'fontsize', 20, ...
'fontweight', 'bold','VerticalAlignment','bottom','HorizontalAlignment','right')
set(gca,'position',[0 0 1 1])
axis equal
end %end of function
function gtSSTCmap()
%make a color space for the Standard Stereographic Triangle
%analyse the pole data
figure
hold on
inc=0.01;
i=1;j=1;
phimax=pi/4;
psimax=atan(sqrt(2));
for phi=[0:inc:(phimax-inc) (phimax-inc)] %around z-axis
j=1;
for psi=[0:inc:(psimax+inc) psimax+inc] % out from z-axis - go slightly further to avoid gaps at edge of triangle
z=cos(psi);
x=sin(psi)*cos(phi);
y=sin(psi)*sin(phi);
%for a colour representation want two angles - phi (around z) and
% alpha (around y)
alpha=atan(x/z); % in sst alpha 0->pi/4
if alpha<=pi/4
rgb=[1-(alpha/(pi/4)) (alpha/(pi/4))*(1-(phi/(pi/4))) (alpha/(pi/4))*(phi/(pi/4))];
% should this be here?
% rgb=rgb/max(rgb);
else
rgb=[1-(alpha/(pi/4)) (alpha/(pi/4))*(1-(phi/(pi/4))) (alpha/(pi/4))*(phi/(pi/4))];
% rgb=rgb/max(rgb);
rgb(find(rgb<0))=0;
rgb(find(rgb>1))=1;
%rgb=[1 1 1];
end
test_normal=[x y z];
%radius distorted for stereographic proj
r_patch=tan([psi/2 (psi+inc)/2]);
[phi_patch,r_patch]=meshgrid([phi phi+inc]',r_patch);
[x_patch,y_patch]=pol2cart(phi_patch,r_patch);
p=patch(x_patch([1 2 4 3]), y_patch([1 2 4 3]), rgb);
set(p, 'edgecolor', 'none')
j=j+1;
end
i=i+1;
end
%add poles and tart up like gtMakePoleFigure
set(gca, 'XTickLabel','')
set(gca, 'YTickLabel','')
set(gca, 'GridLineStyle','none')
set(gca, 'Ycolor', 'w')
set(gca, 'Xcolor', 'w')
set(gca, 'xlim', [-0.02 sqrt(2)-1+0.045])
set(gca, 'ylim', [-0.025 0.3769])
uvw_poles=[0 0 1; 1 0 1; 1 1 1; 1 1 2; 2 1 3];
%uvw_poles=[0 0 1; 1 0 1; 1 1 1;...
% 2 0 1; 2 1 1; 2 2 1;...
% 3 0 1; 3 1 1; 3 2 0; 3 2 1; 3 2 2; 3 3 1; 3 3 2;...
% 4 0 1; 4 1 1; 4 2 1; 4 3 0; 4 3 1; 4 3 2; 4 3 3; 4 4 1; 4 4 3];
symm = gtCrystGetSymmetryOperators('cubic');
uvw_poles2=[];
for i=1:length(symm)
uvw_poles2=[uvw_poles2; uvw_poles*symm(i).g];
end
uvw_poles=[uvw_poles2; -uvw_poles2];
dum=find(uvw_poles(:,2)>=0 & uvw_poles(:,2)<=uvw_poles(:,1) & uvw_poles(:,3)>=uvw_poles(:,1));
uvw_poles=uvw_poles(dum, :);
% plot these uvw/hkl poles
phi_uvw=atan2(uvw_poles(:,2), uvw_poles(:,1));
psi_uvw=acos(uvw_poles(:,3)./(sqrt(sum(uvw_poles.*uvw_poles, 2))));
r_uvw=tan(psi_uvw/2);
dummy=find(r_uvw>1);
r_uvw(dummy)=[];
phi_uvw(dummy)=[];
[x_uvw,y_uvw]=pol2cart(phi_uvw, r_uvw);
dummy=find(x_uvw<-1 | x_uvw>1 | y_uvw<-1 | y_uvw>1);
x_uvw(dummy)=[];
y_uvw(dummy)=[];
plot(x_uvw, y_uvw, 'k*')
text(0, 0-0.015, '(001)')
text(0.366+0.01, 0.366-0.005, '(111)')
text(0.4142-0.015, -0.015, '(101)')
text(0.2247-0.04, 0.2247, '(112)')
text(0.3, 0.153, '(213)')
%text(0.1213-0.04, 0.1213, '(114)')
%text(0.1583-0.04, 0.1583, '(113)')
%text(0.2247-0.04, 0.2247, '(112)')
%text(0.2808-0.04, 0.2808, '(223)')
%text(0.3052-0.045, 0.3052, '(334)')
%text(0.3845+0.01, 0.2884, '(434)')
%text(0.3901+0.01, 0.2601, '(323)')
%text(0.4000+0.01, 0.2000, '(212)')
%text(0.4077+0.01, 0.1359, '(313)')
%text(0.4105+0.01, 0.1026, '(414)')
%text(0.1231-0.02, -0.015, '(104)')
%text(0.1623-0.01, -0.015, '(103)')
%text(0.2361-0.015, -0.015, '(102)')
%text(0.3028-0.02, -0.015, '(203)')
%text(0.3333-0.01, -0.015, '(304)')
%text(0.2967+0.01, 0.1483, '(213)')
%text(0.2330+0.01, 0.1165, '(214)')
%text(0.3297+0.01, 0.1099, '(314)')
%text(0.3197+0.01, 0.2131, '(324)')
% Add a black border line from 101 to 111 is z=x
line_phi=[0:0.01:pi/4 pi/4];
linex=cos(line_phi);
linez=linex;
liney=sin(line_phi);
line_points=[linex' liney' linez'];
%normalise
line_points=line_points./repmat(sqrt(sum(line_points.*line_points, 2)), 1, 3);
%convert to stereographic proj.
line_psi=acos(line_points(:,3));
line_r=tan(line_psi/2);
%stereographic projection x-y
[linex,liney]=pol2cart(line_phi', line_r);
plot([linex; 0; linex(1)], [liney; 0; liney(1)], 'k-')
%add a white patch to mask the rough outer edge of the triangle
xp=[linex; linex(end); 0.55; 0.55; linex(1)];
yp=[liney; 0.379; 0.379; 0; 0];
p=patch(xp, yp, 'w');
set(p, 'edgecolor', 'none')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment