-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfindgeometry_test.m
More file actions
115 lines (99 loc) · 2.62 KB
/
findgeometry_test.m
File metadata and controls
115 lines (99 loc) · 2.62 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
% FINDGEOMETRY_TEST test findgeometry for 'OAB', 'OBCE', 'OADE', etc. of misorientation FZ
clear; close all;
%assumption is 'FCC' or 'BCC' crystal type (2020-06-30)
addpathdir('q2rod.m')
geomchecktypeList = {...
'OAB','OBCE','OADE','CDE',... surfaces
'OB','CE','ED','OE','OA','AC',... lines
'B','E','A','C','O','ABCDEO'}; %points
% geomchecktypeList = {...
% 'B','A','C'}; %points
k = sqrt(2)-1;
load('misFZfeatures.mat','qlist');
for i = 1:length(geomchecktypeList)
geomchecktype = geomchecktypeList{i};
nvtx = length(geomchecktype);
qtmp = zeros(nvtx,4);
for j = 1:length(geomchecktype)
vtx = geomchecktype(j);
qtmp(j,:) = qlist.(vtx);
end
q = mean(qtmp,1); %take the average of the quaternions
q = normr(q); %normalize quaternion
geometry = findgeometry(q);
if strcmp(geomchecktype,'ABCDEO')
geomchecktype = 'interior';
end
check(i) = strcmp(geomchecktype,geometry); %#ok<SAGROW>
end
if all(check) ~= 1
disp('something went wrong with findgeometry(). Displaying ones that do not match.')
disp(geomchecktypeList(~check))
else
disp('geometries matched input test cases.')
end
%-------------------------CODE GRAVEYARD-----------------------------------
%{
for i = 1:length(geomchecktypeList)
geomchecktype = geomchecktypeList{i};
switch geomchecktype
%surfaces
case 'OAB'
q = [1,0.5,1,0];
case 'OBCE'
q = [3,0.5,0.5,1];
case 'OADE'
q = [3 1 2 2];
case 'CDE'
q = [3,0.5,1.5,1];
%lines
case 'OB'
q = [0.5,1,1,0];
case 'CE'
q = [5,1,1,3];
case 'ED'
q = [5 1 2 2];
case 'OE'
q = [0.5,1,1,1];
case 'OA'
q = [0.5,1,0,0];
case 'AC'
q = [1,sqrt(2)-1,2,(sqrt(2)-1)*2];
%points
case 'B'
q = [1/sqrt(1+2*k^2),k/sqrt(1+2*k^2),k/sqrt(1+2*k^2),0];
case 'E'
q = [sqrt(3)/2,1/(2*sqrt(3)),1/(2*sqrt(3)),1/(2*sqrt(3))];
case 'A'
q = [cos(pi/8),sin(pi/8),0,0];
case 'C'
q = 1/(2*sqrt(2))*[1/k,1,1,k];
case 'O'
q = [1,0,0,0];
case 'interior'
q = [0.7489,0.2646,0.2281,0.1336]; %randomly generated (and then plugged into disorientation(q,'cubic')
%q = [1,0.5,1,0]+[3,0.5,1.5,1]; %OAB + CDE examples
end
switch vtx
case 'B'
q = [1/sqrt(1+2*k^2),k/sqrt(1+2*k^2),k/sqrt(1+2*k^2),0];
case 'E'
q = [sqrt(3)/2,1/(2*sqrt(3)),1/(2*sqrt(3)),1/(2*sqrt(3))];
case 'A'
q = [cos(pi/8),sin(pi/8),0,0];
case 'C'
q = 1/(2*sqrt(2))*[1/k,1,1,k];
case 'O'
q = [1,0,0,0];
case 'D'
q = [(7+(-4).*2.^(1/2)).^(-1/2),...
((1/17).*(5+(-2).*2.^(1/2))).^(1/2),...
((1/34).*(5+(-2).*2.^(1/2))).^(1/2),...
((1/34).*(5+(-2).*2.^(1/2))).^(1/2)];
end
vtxlist = zeros(6,4);
for i = 1:length(qnames)
qname = qnames{i};
vtxlist(i,:) = qlist.(qname);
end
%}