forked from dplab/MechMet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBungeOfKocks.m
49 lines (49 loc) · 867 Bytes
/
BungeOfKocks.m
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
function bunge = BungeOfKocks(kocks, units)
% BungeOfKocks - Bunge angles from Kocks angles.
%
% USAGE:
%
% bunge = BungeOfKocks(kocks, units)
%
% INPUT:
%
% kocks is 3 x n,
% the Kocks angles for the same orientations
% units is a string,
% either 'degrees' or 'radians'
%
% OUTPUT:
%
% bunge is 3 x n,
% the Bunge angles for n orientations
%
% NOTES:
%
% * The angle units apply to both input and output.
%
if (nargin < 2)
error('need two arguments: kocks, units')
end
%
if (strcmp(units, 'degrees'))
%
indeg = 1;
%
elseif (strcmp(units, 'radians'))
%
indeg = 0;
%
else
error('angle units need to be specified: ''degrees'' or ''radians''')
end
%
if (indeg)
pi_over_2 = 90;
else
pi_over_2 = pi/2;
end
%
bunge = kocks;
%
bunge(1, :) = kocks(1, :) + pi_over_2;
bunge(3, :) = pi_over_2 - kocks(3, :);