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

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?

답변 (1개)

Jan
Jan 2013년 1월 30일
편집: Jan 2013년 1월 30일
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

Per
Per 2013년 1월 30일
편집: Per 2013년 1월 30일
Thank you! How do I define the start point of the rotation? In this case it rotates around z-axis with [0;0;0] fixed. What if I want the curve to rotate around z-axis but with start in say [11;0,0]?
What I want to achive is a rotation of the black curve around the red axis is this picture:
Jan
Jan 2013년 1월 30일
Subtract the translation before rotating and add the translation afterwards again.
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 ?

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

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

태그

질문:

Per
2013년 1월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by