Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SPR_Implementation
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王鑫(21软)
SPR_Implementation
Commits
f8f7fe69
Commit
f8f7fe69
authored
May 16, 2022
by
王鑫(21软)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
09e038c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
randtrans.m
randtrans.m
+25
-0
No files found.
randtrans.m
0 → 100644
View file @
f8f7fe69
%function:Randomly transform the input matrix to generate test data
% - Params:
% - A:sparse point cloud [n,3]
% - Return:
% - B:the transformed test point cloud [n,3]
% - R:Real rotation matrix [3,3]
% - T:Real translation matrix [1,3]
function
[
B
,
R
,
T
]
=
randtrans
(
A
)
%1.Generate random rotation angles
theta
=
(
2
*
rand
-
1
)
*
60
*
pi
/
180
;
%rotation about z
gamma
=
(
2
*
rand
-
1
)
*
60
*
pi
/
180
;
%rotation about y
alpha
=
(
2
*
rand
-
1
)
*
60
*
pi
/
180
;
%rotation about x
%2.Calculate rotation matrix (right-hand coordinate system)
Rz
=
[
cos
(
theta
),
-
sin
(
theta
),
0
;
sin
(
theta
),
cos
(
theta
),
0
;
0
,
0
,
1
];
Ry
=
[
cos
(
gamma
),
0
,
sin
(
gamma
);
0
,
1
,
0
;
-
sin
(
gamma
),
0
,
cos
(
gamma
)];
Rx
=
[
1
,
0
,
0
;
0
,
cos
(
alpha
),
-
sin
(
alpha
);
0
,
sin
(
alpha
),
cos
(
alpha
)];
R
=
Rz
*
Ry
*
Rx
;
%3.Generate random translation
[
~
,
dim
]
=
size
(
A
);
T
=
randi
([
-
1
,
1
],
1
,
dim
);
%5.Generate the final transformed coordinate B under the transformation matrix
B
=
transform
(
A
,
R
,
T
);
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment