-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcordinateTrans.m
64 lines (53 loc) · 2.09 KB
/
cordinateTrans.m
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
57
58
59
60
61
62
63
64
function [Rt ptSet] = cordinateTrans(x_curr, y_curr, z_curr, ini_x, ini_y, ini_z)
unitX = (atan(abs(x_curr/z_curr)));
unitY = 1;
unitZ = (atan(abs(x_curr/z_curr)));
if z_curr >= 0
if x_curr >= 0
X_delta_1 = cos(unitX);
X_delta_2 = -sin(unitZ);
Z_delta_1 = -sin(unitX); %-sin(unitX);
Z_delta_2 = -cos(unitZ); %-cos(unitZ);
else
X_delta_1 = cos(unitX);
X_delta_2 = sin(unitZ);
Z_delta_1 = sin(unitZ);%sin(unitX);
Z_delta_2 = -cos(unitZ);%-cos(unitZ);
end
elseif z_curr < 0
if x_curr >= 0
X_delta_1 = -cos(unitX);
X_delta_2 = -sin(unitZ);
Z_delta_1 = -sin(unitX); % -sin(unitX);
Z_delta_2 = cos(unitZ); % cos(unitZ);
else
X_delta_1 = -cos(unitX);
X_delta_2 = sin(unitZ);
Z_delta_1 = sin(unitX); % sin(unitX);
Z_delta_2 = cos(unitZ); % cos(unitZ);
end
end
% deltaX = -unitX; deltaZ = -unitZ;
deltaY = unitY;
ptSet(1, :) = [x_curr, y_curr, z_curr];
ptSet(2, :) = [x_curr + X_delta_1, y_curr, z_curr + X_delta_2];
ptSet(3, :) = [x_curr + Z_delta_1, y_curr, z_curr + Z_delta_2];
% ptSet(4, :) = [x_curr - X_delta_1, y_curr, z_curr - X_delta_2];
% ptSet(4, :) = [x_curr, y_curr + deltaY, z_curr];
% ptSet(5, :) = [x_curr, y_curr - deltaY, z_curr];
% ptSet(4, :) = [x_curr , y_curr, z_curr + deltaZ];
% ptSet(5, :) = [x_curr - Z_delta_1, y_curr, z_curr - Z_delta_2];
% ptSet(6, :) = [x_curr + X_delta_1 + Z_delta_1, y_curr + 1, z_curr + X_delta_2 + Z_delta_2];
% ptSet(7, :) = [x_curr - X_delta_1 - Z_delta_1, y_curr - 1, z_curr - X_delta_2 - Z_delta_2];
refSet(1, :) = [ini_x, ini_y, ini_z];
refSet(2, :) = [ini_x + 1, ini_y, ini_z];
refSet(3, :) = [ini_x, ini_y, ini_z + 1];
% refSet(4, :) = [ini_x - 1, ini_y, ini_z];
% % refSet(4, :) = [ini_x, ini_y + 1, ini_z];
% % refSet(5, :) = [ini_x, ini_y - 1, ini_z];
% %refSet(5, :) = [ini_x, ini_y, ini_z + 1];
% refSet(5, :) = [ini_x, ini_y, ini_z + 1];
% refSet(6, :) = [ini_x + 1, ini_y + 1, ini_z - 1];
% refSet(7, :) = [ini_x - 1, ini_y - 1, ini_z + 1];
[Rt, Eps] = estimateRigidTransform(refSet', ptSet');
end