📄 torr_unit2sphere.m
字号:
% By Philip Torr 2002
% copyright Microsoft Corp.
function [a,b] = torr_unit2sphere(rot_axis)
% %convert rot_axis to spherical coords
% sin a sin b
% sin a cos b
% cos a
rot_axis = rot_axis/norm(rot_axis);
%normalize so second coordinate + ve
%rot_axis = rot_axis * sign(rot_axis(2));
a = acos(rot_axis(3));
%b = atan(rot_axis(1)/rot_axis(2));
b = acos(rot_axis(2)/sin(a));
%need to sort the signs out:
% %there are two solutions for a
% a2 = -a;
% b2 = -b;
if abs(rot_axis(1) - sin(a) * sin(b)) < 0.000001
return
else
b = -b;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -