필터 지우기
필터 지우기

What is the best way to rotate a line from a central point?

조회 수: 1 (최근 30일)
John Hart
John Hart 2017년 5월 11일
답변: Sergey Kasyanov 2017년 5월 11일
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?

답변 (1개)

Sergey Kasyanov
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;

카테고리

Help CenterFile Exchange에서 3-D Scene Control에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by