From cc4e7ccbb33be3ae8895c9cce3f48dcfbc213c47 Mon Sep 17 00:00:00 2001
From: Yoann Guilhem <yoann.guilhem@esrf.fr>
Date: Thu, 3 Jan 2013 15:15:14 +0000
Subject: [PATCH] Update SST inverse pole figure (IPF) functions (1st commit)

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@972 4c865b51-4357-4376-afb4-474e03ccb993
---
 zUtil_Cryst/gtCrystVector2SST.m | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/zUtil_Cryst/gtCrystVector2SST.m b/zUtil_Cryst/gtCrystVector2SST.m
index 6cb5985a..8ad4b159 100644
--- a/zUtil_Cryst/gtCrystVector2SST.m
+++ b/zUtil_Cryst/gtCrystVector2SST.m
@@ -1,7 +1,7 @@
-function [rgb, Vsst, Vsst_p] = gtCrystVector2SST(Vc, crystal_system, symm, saturation)
+function [rgb, Vsst, Vsst_p] = gtCrystVector2SST(Vc, crystal_system, symm, saturate)
 % GTCRYSTVECTOR2SST  Moves crystal vectors to SST zone.
 %
-%    [rgb, Vsst, Vsst_p] = gtCrystVector2SST(Vc, crystal_system, symm[, saturation])
+%    [rgb, Vsst, Vsst_p] = gtCrystVector2SST(Vc, crystal_system, symm[, saturate])
 %    -------------------------------------------------------------------------------
 %
 %    INPUT:
@@ -10,7 +10,7 @@ function [rgb, Vsst, Vsst_p] = gtCrystVector2SST(Vc, crystal_system, symm, satur
 %      symm           = <cell_array> Symmetry operators
 %
 %    OPTINAL INPUT:
-%      saturation     = <logical>    Saturate or not the RGB output {true}
+%      saturate       = <logical>    Saturate or not the RGB output {true}
 %
 %    OUTPUT:
 %      rgb            = <double>     RGB colors in the SST triangle
@@ -20,8 +20,8 @@ function [rgb, Vsst, Vsst_p] = gtCrystVector2SST(Vc, crystal_system, symm, satur
 %
 %    Version 001 15-10-2012 by YGuilhem
 
-    if ~exist('saturation', 'var') || isempty(saturation)
-        saturation = true;
+    if ~exist('saturate', 'var') || isempty(saturate)
+        saturate = true;
     end
 
     % Normalize vectors?
@@ -57,7 +57,7 @@ function [rgb, Vsst, Vsst_p] = gtCrystVector2SST(Vc, crystal_system, symm, satur
 
     switch crystal_system
     case {'cubic', 'cub'}
-        anglesR   = 45 - Vc_chi; % red color proportional to (45-chi)
+        anglesR   = 45 - Vc_chi; % red color proportional to (45 - chi)
         minAngleR =  0;
         maxAngleR = 45;
         anglesB   = Vc_phi; % blue color proportional to phi
@@ -120,7 +120,8 @@ function [rgb, Vsst, Vsst_p] = gtCrystVector2SST(Vc, crystal_system, symm, satur
     blue  = (maxAngleR - angleR)/maxAngleR .* angleB/maxAngleB;
 
     rgb = [red green blue];
-    if saturation
+    if saturate
+        rgb = sqrt(rgb);
         sat = max(rgb, [], 2);
         rgb = rgb./sat(:, [1 1 1]);
     end
-- 
GitLab