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!

