Changing the center of rotation of a 3D object

조회 수: 25(최근 30일)
Adriana Dasier Marchena Garcia
Adriana Dasier Marchena Garcia 2020년 12월 1일
답변: Priyanka Rai 2020년 12월 28일
Hello,
I want to change my center of rotation of a 3D object that is attached down below. I would like to know how to change the center of rotation of the 3D object, in this case, I would want to be one center in the shoulder and the second one in the middle of the body. In that way when I rotate a separate object, in this case, the torso, the shoulder should follow the movement but I also want that the shoulder moves by itself only if the torso is not moving.
Thank you for your attention,
Ps: I attached the code and an image

답변(1개)

Priyanka Rai
Priyanka Rai 2020년 12월 28일
rotate(h,direction,alpha) -rotate object about specified origin and direction.
rotate(...,origin) - specifies the origin of the axis of rotation as a three-element vector [x0,y0,z0].
So, make a new 3D vector to define the origin. Then add it as the fourth input parameter.
hSurface = surf(peaks(10));
direction = [1 2 3];
origin = [0 0 0]; %set origin of axis of rotation to plot origin instead of the center of object
rotate(hSurface,direction,20,origin); %add the vector to the parameters
You can use this reference for further details:

태그

Community Treasure Hunt

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

Start Hunting!

Translated by