source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/torr/torr_unit2sphere.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 575 bytes
Line 
1%       By Philip Torr 2002
2%       copyright Microsoft Corp.
3function [a,b] = torr_unit2sphere(rot_axis)
4
5% %convert rot_axis to spherical coords
6% sin a sin b
7% sin a cos b
8% cos a
9rot_axis = rot_axis/norm(rot_axis);
10
11%normalize so second coordinate + ve
12%rot_axis = rot_axis * sign(rot_axis(2));
13
14a = acos(rot_axis(3));
15%b = atan(rot_axis(1)/rot_axis(2));
16b = acos(rot_axis(2)/sin(a));
17
18%need to sort the signs out:
19% %there are two solutions for a
20% a2 = -a;
21% b2 = -b;
22
23
24if abs(rot_axis(1) - sin(a) * sin(b)) < 0.000001
25    return
26else
27    b = -b;
28end
29
Note: See TracBrowser for help on using the repository browser.