Borrar filtros
Borrar filtros

How to rotate a curve in the xz-plane around z axis?

2 visualizaciones (últimos 30 días)
Per
Per el 30 de En. de 2013
I have a curve difined in a vector M with values in x and z position. I use "plot3" to plot this but now I want to rotate this curve around some axis, preferable z-axis so that it creates a body. In my case it will have a shape of a mountain.
Is this possible?

Respuestas (1)

Jan
Jan el 30 de En. de 2013
Editada: Jan el 30 de En. de 2013
Rotation around the Z-axis by the angle a:
R = [ cos(a), sin(a), 0; ...
-sin(a), cos(a), 0; ...
0, 0, 1];
Points = rand(3, 100);
RotatedPoints = R * Points;
  3 comentarios
Jan
Jan el 30 de En. de 2013
Subtract the translation before rotating and add the translation afterwards again.
Per
Per el 4 de Feb. de 2013
I dont see it. How do I subtract the translation? say it's 3 in x-dir and 5 in y-dir, will it look like:
R = [ cos(a), sin(a), 0; ...
-sin(a), cos(a), 0; ...
-3, -5, 1];
and then after the Curve*R I then add +3 and +5 ?

Iniciar sesión para comentar.

Categorías

Más información sobre Line Plots 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