-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmp_discretizing_OR.m
More file actions
64 lines (52 loc) · 2.17 KB
/
cmp_discretizing_OR.m
File metadata and controls
64 lines (52 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
% compare different ways of discretizing orientations
% October 3rd, 2021
clear all;
close all;
cs = crystalSymmetry('cubic');
% method 1, Improved orientation sampling for indexing diffraction patterns
% of polycrystalline materials, 2017
% read orientation data generated by hyperspherical-coverings by Søren Schmidt
q = dlmread('Ori.txt', ' ', 1, 0);
r=rotation(quaternion(q(:,1),q(:,2),q(:,3),q(:,4)));
ori=orientation(r,cs)
figure;plot(ori,'axisAngle','all');
misori_min1=misori_min_calc(ori);
sprintf('Neighboring misorientation is %.4f degrees',min(nonzeros(misori_min1(:,1))))
if angle(ori(round(length(ori)/2)),ori(round(length(ori)/2)+1))./degree<=5
sprintf('Neighboring misorientation is %.4f degrees', ...
angle(ori(round(length(ori)/2)),ori(round(length(ori)/2)+1))./degree)
else
sprintf('Neighboring misorientation is %.4f degrees', ...
angle(ori(104),ori(105))./degree)
end
ori1=ori;
% method 2, mtex gridding method
% define a grid of orientations
ori = equispacedSO3Grid(cs,'resolution',3*degree)
figure;plot(ori,'axisAngle','all');
misori_min2=misori_min_calc(ori);
sprintf('Neighboring misorientation is %.4f degrees',min(nonzeros(misori_min2(:,1))))
if angle(ori(round(length(ori)/2)),ori(round(length(ori)/2)+1))./degree<=5
sprintf('Neighboring misorientation is %.4f degrees', ...
angle(ori(round(length(ori)/2)),ori(round(length(ori)/2)+1))./degree)
else
sprintf('Neighboring misorientation is %.4f degrees', ...
angle(ori(100),ori(101))./degree)
end
ori2=ori;
% method 3, gridding on quaternions
nDiv=30; % 25-3.06deg, 30-2.78deg
OR=ori_division(nDiv);
r=rotation(quaternion(OR.q(:,1),OR.q(:,2),OR.q(:,3),OR.q(:,4)));
ori=orientation(r,cs)
figure;plot(ori,'axisAngle','all');
misori_min3=misori_min_calc(ori);
sprintf('Neighboring misorientation is %.4f degrees',min(nonzeros(misori_min3(:,1))))
if angle(ori(round(length(ori)/2)),ori(round(length(ori)/2)+1))./degree<=5
sprintf('Neighboring misorientation is %.4f degrees', ...
angle(ori(round(length(ori)/2)),ori(round(length(ori)/2)+1))./degree)
else
sprintf('Neighboring misorientation is %.4f degrees', ...
angle(ori(100),ori(101))./degree)
end
ori3=ori