Rotate clouds of points

조회 수: 1 (최근 30일)
ana
ana 2011년 6월 15일
댓글: haishan zhu 2017년 8월 30일
Hello!
I have one clouds of points, which are represented in 2D. I need one function that give me one new clouds of points if I have the following input parameters: an specific angle and distance applied to the initial clouds of points, so at the end, the new clouds of points have the same shape, but it stay shifted and rotated. Is there any function done in Matlab? Any idea??
  댓글 수: 1
Ashish Uthama
Ashish Uthama 2011년 6월 15일
In what form do you have these points? x and y values? or a 2D matrix? How do you define the origin for the rotation?
Basic geometry: you could rotate them first by converting to polar coordinates (cart2pol) and then adding the angle. Convert back to cart (pol2cart) and just add the shift to the x and/or y values.

댓글을 달려면 로그인하십시오.

답변 (1개)

Ashish Uthama
Ashish Uthama 2011년 6월 15일
x=1:.01:2;
y=sin(2*pi*x);
plot(y,x,'k*');
hold on;
% rotate by 30 clockwise around (0,0)
% http://en.wikipedia.org/wiki/Rotation_matrix
rotAngle = deg2rad(30);
xRot = x*cos(rotAngle) - y*sin(rotAngle);
yRot = x*sin(rotAngle) + y*cos(rotAngle);
plot(yRot,xRot,'b*');
%and move by (3 2)
xRotShift = xRot + 3;
yRotShift = yRot + 5;
plot(yRotShift,xRotShift,'r*');
  댓글 수: 3
Ashish Uthama
Ashish Uthama 2011년 6월 17일
yes.
haishan zhu
haishan zhu 2017년 8월 30일
how about 3 dimension condinates? thank you

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Point Cloud Processing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by