What is the best way to rotate a line from a central point?
1 次查看(过去 30 天)
显示 更早的评论
I want to rotate a line around a central point so that it matches up with another point. How is best to do this in Matlab?
0 个评论
回答(1 个)
Sergey Kasyanov
2017-5-11
Hi, try this:
%y, x - line coordinates
%a, b - point coordinates
%phi - rotating angle in radians counterclockwise
A=(x+1i*y-a-1i*b)*exp(1i*phi); %go to complex plane and rotate
xnew=real(A)+a; %go to real world
ynew=imag(A)+b;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 3-D Scene Control 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!