grasp
Main Page
Modules
+
Namespaces
Namespace List
+
Namespace Members
All
Functions
+
Data Structures
Data Structures
+
Data Fields
All
Functions
+
Files
File List
•
All
Data Structures
Namespaces
Functions
Modules
precision-grasp
graspSynthesis
app
matlab
dcm2axis.m
1
function
v=dcm2axis(R)
2
3
sz=size(R);
4
5
if (sz(1)<3) || (sz(2)<3)
6
disp('failed');
7
v=[];
8
return;
9
end
10
11
v=zeros(4,1);
12
v(1)=R(3,2)-R(2,3);
13
v(2)=R(1,3)-R(3,1);
14
v(3)=R(2,1)-R(1,2);
15
r=norm(v);
16
theta=atan2(0.5*r,0.5*(R(1,1)+R(2,2)+R(3,3)-1));
17
18
if (r<1e-9)
19
A=R(1:3,1:3);
20
21
[~,~,V]=svd(A-eye(3,3));
22
23
v(1)=V(1,3);
24
v(2)=V(2,3);
25
v(3)=V(3,3);
26
r=norm(v);
27
end
28
29
v=v/r;
30
v(4)=theta;
Generated by
1.8.12