MATLAB Answers

How to rotate 3D matrix?

조회 수: 3(최근 30일)
Florence 2021년 5월 11일
댓글: Florence 2021년 5월 11일
I have 3 matrices for surf commands: X, Y, Z. I transformed the matrix so that the surface rotates -45 degrees around the OY axis. But now my current code can make it rotate -45 degrees, but it deviates A (one edge of the surface)form a certain distance. Can someone help me improve my code to make the surface rotate with A as the axis?thank you very much!.
My code is below:
R=[cosd(a) sind(a);-sind(a) cosd(a)];

채택된 답변

J. Alex Lee
J. Alex Lee 2021년 5월 11일
it looks like your segment A is parallel to the axis OA (trivial in y-direction), in which case it should be easy to first translate such that A and OA coincide...then do your rotation, then untranslate to put A back where it belongs.
depending on what you need, this might be useful (disclaimer i have not used hgtransform before):
  댓글 수: 1
Florence 2021년 5월 11일
First of all thank you for your reply, I will think about it seriously. Thank you very much

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

추가 답변(0개)


Community Treasure Hunt

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

Start Hunting!

Translated by