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!

