rotation matrix 3D point data
Mostra commenti meno recenti
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?

Risposta accettata
Più risposte (1)
KSSV
il 11 Mag 2018
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 Commenti
Jan
il 11 Mag 2018
Where does the value of 38 deg come from?
ha ha
il 11 Mag 2018
Jan
il 11 Mag 2018
@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
il 11 Mag 2018
Categorie
Scopri di più su Generic Geometric Transformations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

