mtex-toolbox / mtex

MTEX is a free Matlab toolbox for quantitative texture analysis. Homepage:
http://mtex-toolbox.github.io/
GNU General Public License v2.0
281 stars 185 forks source link

Don't convert quaternion coefficients to degrees in export #1354

Closed hakonanes closed 2 years ago

hakonanes commented 2 years ago

Signed-off-by: Håkon Wiik Ånes hwaanes@gmail.com

Writing quaternion coefficients to file

>> q = quaternion.rand(5)
q = quaternion (show methods, plot)
  size: 5 x 1
           a          b          c          d
  -0.0648726  -0.809528   0.342683   0.472254
     0.37502  -0.837579  -0.162312  -0.362596
   -0.425613  -0.288554 -0.0593885  -0.855607
    0.236986   0.740326  -0.626879  -0.052697
    -0.24426  -0.448668  0.0160699   0.859521
>> export(q, 'quaternions.txt', 'quaternion')

assumes they are angles in radians and converts them to degrees

>> type quaternions.txt  % Shows content of text file
       a        b        c        d
-3.71692 -46.3825  19.6343  27.0582
 21.4871 -47.9897  -9.2998 -20.7752
-24.3858 -16.5329 -3.40271 -49.0227
 13.5783  42.4176 -35.9175 -3.01932
-13.9951 -25.7068 0.920736  49.2469

while with this PR, whether 'radians' is passed or not is ignored when 'quaternion' is passed, as expected

>> type quaternions.txt
         a          b          c          d
-0.0648726  -0.809528   0.342683   0.472254
   0.37502  -0.837579  -0.162312  -0.362596
 -0.425613  -0.288554 -0.0593885  -0.855607
  0.236986   0.740326  -0.626879  -0.052697
  -0.24426  -0.448668  0.0160699   0.859521