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

Cleaned and optimized some utility functions (maths, imaging and cryst)

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@937 4c865b51-4357-4376-afb4-474e03ccb993
parent 8f2b77ac
No related branches found
No related tags found
No related merge requests found
......@@ -83,21 +83,23 @@ function [rgb, Vsst, Vsst_p] = gtCrystVector2SST(Vc, crystal_system, symm, satur
ok_too = (ok > 1);
if any(ok_no)
warning('Problem when moving to SST triangle, no indices found for vectors:');
warning('gtCrystVector2SST:no_indices_found', ...
'Problem when moving to SST triangle, no indices found for vectors:');
disp(' indices:');
disp(find(ok_no)');
disp(' vectors:');
disp(Vc(find(ok_no), :));
disp(Vc(ok_no, :));
iSST(1, :, ok_no) = 1;
anglesR(1, :, ok_no) = 0;
anglesB(1, :, ok_no) = 0;
end
if any(ok_too)
warning('Might be a problem when moving to SST triangle, too many indices found!');
warning('gtCrystVector2SST:too_many_indices_found', ...
'Might be a problem when moving to SST triangle, too many indices found!');
disp(' indices:');
disp(find(ok_too)');
disp(' vectors:');
disp(Vc(find(ok_too), :));
disp(Vc(ok_too, :));
i_too = find(iSST(:, :, ok_too));
iSST(i_too(2:end), :, ok_too) = 0;
end
......
......@@ -17,7 +17,6 @@ function rgb = hsl2rgb(hsl, progress)
% Note:
% See also rgb2hsl, rgb2hsv, hsv2rgb
%
%
% Version 002 16-10-2012 by YGuilhem
% Add an option to display progress report
%
......@@ -25,7 +24,6 @@ function rgb = hsl2rgb(hsl, progress)
if max(max(hsl))>1 || min(min(hsl))<0,
error('HSL values have to be between 0 and 1');
return;
end;
todo = size(hsl, 1);
......@@ -48,6 +46,7 @@ for i=1:size(hsl,1),
temp2=hsl(i,3)+hsl(i,2)-hsl(i,3)*hsl(i,2);
end;
temp1=2*hsl(i,3)-temp2;
temp3=zeros(size(temp1));
temp3(1)=hsl(i,1)+1/3;
temp3(2)=hsl(i,1);
temp3(3)=hsl(i,1)-1/3;
......@@ -70,7 +69,7 @@ for i=1:size(hsl,1),
% Give a progress report for long lists
if progress && mod(i, 1000)==0
disp(sprintf('% 5.1f %%', 100*i/todo));
fprintf('% 5.1f %%', 100*i/todo);
end
end
......
......@@ -25,7 +25,6 @@ function hsl = rgb2hsl(rgb, progress)
if max(max(rgb))>1 || min(min(rgb))<0,
error('RGB values have to be between 0 and 1');
return;
end;
todo = size(rgb, 1);
......@@ -67,7 +66,7 @@ for i=1:size(rgb,1),
% Give a progress report for long lists
if progress && mod(i, 1000)==0
disp(sprintf('% 5.1f %%', 100*i/todo));
fprintf('% 5.1f %%', 100*i/todo);
end
end
......
......@@ -22,12 +22,6 @@ if size(euler, 2) ~= 3
'Given matrix size is not Mx3!');
end
% Get number of r vectors
M = size(euler, 1);
% Set epsilon to avoid singular values
epsilon = 1.e-9;
% Create Euler angles vectors
phi1 = euler(:, 1);
phi = euler(:, 2);
......
......@@ -23,9 +23,6 @@ if size(r, 2) ~= 3
'Given matrix size is not Mx3!');
end
% Get number of r vectors
M = size(r, 1);
% Set epsilon to avoid singular values
epsilon = 1.e-9;
......
......@@ -56,6 +56,7 @@ w = [ n0 , n3 , -n2 ; ...
n2 , -n1 , n0 ];
% Squared w matrix
w2 = zeros(size(w));
for ig=1:M
w2(:, :, ig) = w(:, :, ig)^2;
end
......
......@@ -19,7 +19,7 @@ function euler = gtMathsRotMat2Euler(g)
% Version 001 15-06-2012 by YGuilhem
% Check size of g matrix
if size(g{1}) ~= [3 3]
if any(size(g{1}) ~= 3)
gtError('RotMat:wrong_matrix_size', 'Given matrices size is not 3x3!');
end
......
......@@ -27,9 +27,6 @@ else
gtError('RotMat:wrong_matrix_size', 'Given matrices size is not 3x3!');
end
% Get number of rotation matrices and allocate Euler angles vectors
M = length(g);
% Set epsilon to avoid singular values
epsilon = 1.e-9;
......
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