-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathExp_Matrix.m
More file actions
62 lines (44 loc) · 1.25 KB
/
Copy pathExp_Matrix.m
File metadata and controls
62 lines (44 loc) · 1.25 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
%%
function [R,T]=Exp_Matrix(mu,pseudo_exponential)
T=zeros(3,1);
one_6th = 1.0/6.0;
one_20th = 1.0/20.0;
mu_xyz = mu(1:3);
w = mu(4:6);
theta=norm(w);
theta_sq=theta^2;
vCross=cross(w,mu_xyz);
if theta_sq < 1e-8
A = 1.0 - one_6th * theta_sq;
B = 0.5;
if pseudo_exponential==0
T(1) = mu_xyz(1) + 0.5 * vCross(1);
T(2) = mu_xyz(2) + 0.5 * vCross(2);
T(3) = mu_xyz(3) + 0.5 * vCross(3);
end
else
if theta_sq < 1e-6
C = one_6th*(1.0 - one_20th * theta_sq);
A = 1.0 - theta_sq * C;
B = 0.5 - 0.25 * one_6th * theta_sq;
else
inv_theta = 1.0/theta;
A = sin(theta) * inv_theta;
B = (1 - cos(theta)) * (inv_theta * inv_theta);
C = (1 - A) * (inv_theta * inv_theta);
end
w_cross=cross(w,vCross); % = w^cross
if pseudo_exponential==0
% result.get_translation() = mu_xyz + B * cross + C * (w ^ cross);
T(1) = mu_xyz(1) + B * vCross(1) + C * w_cross(1);
T(2) = mu_xyz(2) + B * vCross(2) + C * w_cross(2);
T(3) = mu_xyz(3) + B * vCross(3) + C * w_cross(3);
end
end
% 3x3 rotation part:
R=Rodrigues_SO3_Exp(w, A, B);
if pseudo_exponential~=0
T = mu_xyz;
% else: has been already filled in above.
end
end