rotation matrix 3D point data
显示 更早的评论
Let' say , I have the 3d point data in format [xi yi zi] of 176 point as show in attachment file test.txt. The 3d point data is as below figure (shown in OXY plane):

Now, I want to find rotate the data around axis OZ , and 1 edge of the rectangle // Ox, the other //Oy as the below image. How to find new coordinate?

采纳的回答
更多回答(1 个)
KSSV
2018-5-11
You need to rotate your data by certain angle to achieve what you shown. You need to know Affine transformations. Check the below code.
coor = load('test.txt') ;
x = coor(:,1) ; y = coor(:,2) ; % (x,y) points
x0 = x-mean(x) ; y0 = y-mean(y) ; % remove mean
A = [x0 y0 ones(size(x))] ;
th = 38 ; % angle in degrees by which data is rotated
T = [cosd(th) sind(th) 0 ; -sind(th) cosd(th) 0 ; 0 0 1] ; % TRansformation matrix
At = A*T ; % rotate the dat
At = [At(:,1)+mean(x) At(:,2)+mean(y)] ; % Add mean to At
plot(x,y,'.r') ;
hold on
plot(At(:,1),At(:,2),'.b') ;

4 个评论
Jan
2018-5-11
Where does the value of 38 deg come from?
ha ha
2018-5-11
Jan
2018-5-11
@ha ha: Showing a 2D view was confusing. But the problem can be reduced to 2D easily by finding the plane nearest to all points at first and use e.g. fitgeotrans on the points projected into this plane.
ha ha
2018-5-11
类别
在 帮助中心 和 File Exchange 中查找有关 Generic Geometric Transformations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

