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

1 visualización (últimos 30 días)
John Hart
John Hart el 11 de Mayo de 2017
Respondida: Sergey Kasyanov el 11 de Mayo de 2017
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?

Respuestas (1)

Sergey Kasyanov
Sergey Kasyanov el 11 de Mayo de 2017
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;

Categorías

Más información sobre 3-D Scene Control en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by