-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanglealpha.m
More file actions
35 lines (29 loc) · 1.06 KB
/
Copy pathanglealpha.m
File metadata and controls
35 lines (29 loc) · 1.06 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
function alpha = anglealpha(theta, phi)
% Ôóíêö³ÿ êóòà â³äõèëåííÿ â³ä íàäèðó
% alpha - êóò â³äõèëåííÿ òî÷êè â³ä îñ³ íàäèðó
% theta - ïðîåêö³ÿ êóòà â³äõèëåííÿ íà ïëîùèíó âçäîâæ ïîëüîòó
% phi - ïðîåêö³ÿ êóòà â³äõèëåííÿ íà ïëîùèíó ïîïåðåê ïîëüîòó
% Âñ³ êóòè â ðàä³àíàõ
% âèáèòè ïîìèëêó ÷åðåç íåñê³í÷åíí³ñòü ïðè êóò³ â 90°
% alpha = atan(sqrt(tan(theta) .^ 2 + tan(phi) .^ 2));
% Äîäàòêîâ³ âàð³àíòè ðîçðàõóíêó
% theta2 = atan(tan(phi) .* cos(theta));
% phi2 = atan(tan(theta) .* cos(phi));
% alpha = acos(cos(theta) .* cos(theta2));
% alpha = acos(cos(phi) .* cos(phi2));
% alpha = asin(sqrt(sin(theta2) .^ 2 + sin(phi2) .^ 2));
% Òîìó óòî÷íèìî àëãîðèòì
if abs(phi) == (pi / 2)
% ßêùî êóò phi = 90°, òî
phi2 = atan(tan(theta) .* cos(phi));
alpha = acos(cos(phi) .* cos(phi2));
elseif abs(theta) == (pi / 2)
% ßêùî êóò theta = 90°, òî
theta2 = atan(tan(phi) .* cos(theta));
alpha = acos(cos(theta) .* cos(theta2));
elseif (abs(phi) ==(pi / 2)) && (abs(theta) == (pi / 2))
alpha = pi / 2;
else
alpha = atan(sqrt(tan(theta) .^ 2 + tan(phi) .^ 2));
end
end