http://www.mathworks.com/matlabcentral/newsreader/view_thread/314432
MATLAB Central Newsreader  Center of Rotation in 3D motion
Feed for thread: Center of Rotation in 3D motion
enus
©19942014 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Wed, 16 Nov 2011 04:46:30 +0000
Center of Rotation in 3D motion
http://www.mathworks.com/matlabcentral/newsreader/view_thread/314432#858614
Serkan
I have a set of 3D marker data attached on a body that rotates around a semiconstrained joint. I would like to find the center of rotation in threedimensional coordinate system (x,y,z). Do you know any matlab codes for this calculation? <br>
Thanks a bunch!<br>
<br>
<br>
<br>

Wed, 16 Nov 2011 19:52:13 +0000
Re: Center of Rotation in 3D motion
http://www.mathworks.com/matlabcentral/newsreader/view_thread/314432#858684
Roger Stafford
"Serkan" wrote in message <j9vf76$e5v$1@newscl01ah.mathworks.com>...<br>
> I have a set of 3D marker data attached on a body that rotates around a semiconstrained joint. I would like to find the center of rotation in threedimensional coordinate system (x,y,z). Do you know any matlab codes for this calculation? <br>
> Thanks a bunch!<br>
        <br>
Perhaps we can rephrase the statement of your problem. You have a set of 3D cartesian coordinates of your "marker data", P, and at a later moment another set, Q, of coordinates of these corresponding points after a period of rotation about some line. You would like to know what that line of rotation is. Do I state things correctly?<br>
<br>
It can be shown that any displacement of a rigid 3D body can be accomplished by a rotation about some axis combined with a translation along that axis  a "screw" type displacement. Presumably in your case there is known to be no such translational component along the axis, only a pure rotation about the axis through some angle.<br>
<br>
It can also be shown that the best fit between the two corresponding point sets in a least squares sense can be achieved by translating each of their centroids to the origin and then rotating one of them via a rotation matrix about the origin to best fit the other. This latter can be accomplished using matlab's 'svd' (singular value decomposition) function utilizing the Kabsch algorithm. See for example:<br>
<br>
<a href="http://en.wikipedia.org/wiki/Kabsch_algorithm">http://en.wikipedia.org/wiki/Kabsch_algorithm</a><br>
<br>
The equivalent can also be done using the Statistics Toolbox function 'procrustes' appropriately. See its documentation.<br>
<br>
Your next task is to determine from this rotation matrix the corresponding axis of rotation and the angle of rotation. For this you can use the technique shown in:<br>
<br>
<a href="http://en.wikipedia.org/wiki/Rotation_matrix">http://en.wikipedia.org/wiki/Rotation_matrix</a><br>
<br>
using matlab's 'eig' function.<br>
<br>
Finally, from the axis of rotation relative to the centroid of one of the sets, the rotation angle, and the translation between the two centroids, it is a problem in solid geometry to determine where the parallel axis of "pure" rotation is located that requires no translation, and which is presumably what you are seeking. I'll let you solve that part on your own. You can probably make good use of matlab's cross product function, 'cross', for this purpose.<br>
<br>
Roger Stafford

Wed, 16 Nov 2011 20:10:26 +0000
Re: Center of Rotation in 3D motion
http://www.mathworks.com/matlabcentral/newsreader/view_thread/314432#858688
Serkan
Thank very much Roger for your kind response. I will take a look at the techniques and resources you referred. I hope that you would be available to answer my questions if I had further along the road. <br>
Kind Regards...

Wed, 16 Nov 2011 20:23:29 +0000
Re: Center of Rotation in 3D motion
http://www.mathworks.com/matlabcentral/newsreader/view_thread/314432#858691
Matt J
"Roger Stafford" wrote in message <ja149d$2k4$1@newscl01ah.mathworks.com>...<br>
><br>
> It can also be shown that the best fit between the two corresponding point sets in a least squares sense can be achieved by translating each of their centroids to the origin and then rotating one of them via a rotation matrix about the origin to best fit the other. This latter can be accomplished using matlab's 'svd' (singular value decomposition) function utilizing the Kabsch algorithm. See for example:<br>
> <br>
> <a href="http://en.wikipedia.org/wiki/Kabsch_algorithm">http://en.wikipedia.org/wiki/Kabsch_algorithm</a><br>
> <br>
> The equivalent can also be done using the Statistics Toolbox function 'procrustes' appropriately. See its documentation.<br>
> <br>
> Your next task is to determine from this rotation matrix the corresponding axis of rotation and the angle of rotation. For this you can use the technique shown in:<br>
=========<br>
<br>
@Serkan, all of the tasks that Roger has described here, including the extraction of the rotation axis, can be done virtually simultaneously using this tool from the File Exchange<br>
<br>
<a href="http://www.mathworks.com/matlabcentral/fileexchange/26186absoluteorientationhornsmethod">http://www.mathworks.com/matlabcentral/fileexchange/26186absoluteorientationhornsmethod</a><br>
<br>
To illustrate this, consider the following data, in which I rotate the columns of A about the axis that is parallel to [1 2 5] and translated by [10,20,30] to produce data set B.<br>
<br>
>> A=rand(3,5); <br>
>> B=AxelRot(A,20,[1 2 5],[ 10,20,30]);<br>
>> <br>
>> reg=absor(A,B);<br>
>> axisOfrotation=reg.q(2:end)/reg.q(2)<br>
<br>
axisOfrotation =<br>
<br>
1.0000<br>
2.0000<br>
5.0000<br>
<br>
>> axisShift=pinv(eye(3)reg.R)*reg.t<br>
<br>
axisShift =<br>
<br>
3.3333<br>
6.6667<br>
3.3333<br>
<br>
<br>
<br>
A few notes:<br>
<br>
1. The AxelRot function is my own utility function, but is available here<br>
<br>
<a href="http://www.mathworks.com/matlabcentral/fileexchange/308643drotationaboutshiftedaxis">http://www.mathworks.com/matlabcentral/fileexchange/308643drotationaboutshiftedaxis</a><br>
<br>
<br>
2. The axisShift is not uniquely defined. Both it and [10;20;30] however will satisfy the equation<br>
<br>
xreg.R*x=reg.t<br>
<br>
The following verifies this:<br>
<br>
>> (eye(3)reg.R)*axisShift  reg.t<br>
<br>
ans =<br>
<br>
1.0e014 *<br>
<br>
0.0888<br>
0.1443<br>
0.5634<br>
<br>
>> (eye(3)reg.R)*[10;20;30]  reg.t<br>
<br>
ans =<br>
<br>
1.0e013 *<br>
<br>
0.1377<br>
0.3242<br>
0.1349

Wed, 16 Nov 2011 21:34:26 +0000
Re: Center of Rotation in 3D motion
http://www.mathworks.com/matlabcentral/newsreader/view_thread/314432#858698
Matt J
"Roger Stafford" wrote in message <ja149d$2k4$1@newscl01ah.mathworks.com>...<br>
><br>
> It can be shown that any displacement of a rigid 3D body can be accomplished by a rotation about some axis combined with a translation along that axis  a "screw" type displacement. <br>
================<br>
<br>
I don't see how that can be true, Roger.<br>
If I start with an arbitrary rototranslation<br>
<br>
y=R*x+t<br>
<br>
then your comment here seems to say that there is a 2nd equivalent decomposition<br>
<br>
y=Ra*x+ta<br>
<br>
where Ra and ta are a rotation/translation about/along some axis. But the representation of a rototranslation is unique, so that would imply R=Ra, t=ta implying in turn that all rotations are rotations about an axis and all translations are translations along an axis. Obviously, there's something I'm missing here...<br>
<br>

Wed, 16 Nov 2011 22:57:11 +0000
Re: Center of Rotation in 3D motion
http://www.mathworks.com/matlabcentral/newsreader/view_thread/314432#858712
Roger Stafford
"Matt J" wrote in message <ja1a92$n0j$1@newscl01ah.mathworks.com>...<br>
> "Roger Stafford" wrote in message <ja149d$2k4$1@newscl01ah.mathworks.com>...<br>
> > It can be shown that any displacement of a rigid 3D body can be accomplished by a rotation about some axis combined with a translation along that axis  a "screw" type displacement. <br>
> <br>
> I don't see how that can be true, Roger.<br>
> If I start with an arbitrary rototranslation<br>
> <br>
> y=R*x+t<br>
> <br>
> then your comment here seems to say that there is a 2nd equivalent decomposition<br>
> <br>
> y=Ra*x+ta<br>
> <br>
> where Ra and ta are a rotation/translation about/along some axis. But the representation of a rototranslation is unique, so that would imply R=Ra, t=ta implying in turn that all rotations are rotations about an axis and all translations are translations along an axis. Obviously, there's something I'm missing here...<br>
         <br>
Yes, the statement I made is quite true, Matt. It is a fundamental theorem in kinematics due to Chasles. See the site:<br>
<br>
<a href="http://en.wikipedia.org/wiki/Chasles">http://en.wikipedia.org/wiki/Chasles</a>'_theorem<br>
<br>
It is also stated in the book "Analytical Dynamics" by E. T. Whittaker where it says, "the most general displacement of a rigid body can be obtained by first translating the body, and then rotating it about a line." Also it says, "This combination of a translation and a rotation round a line parallel to the direction of translation is called a screw."<br>
<br>
Remember that writing the homogeneous expression R*x with R a "rotation matrix" involves only a rotation about a line passing through the coordinate origin. Chasles' theorem speaks of a rotation about a line that doesn't necessarily pass through the origin, together with a translation parallel to that same line.<br>
<br>
Roger Stafford<br>

Wed, 16 Nov 2011 23:20:28 +0000
Re: Center of Rotation in 3D motion
http://www.mathworks.com/matlabcentral/newsreader/view_thread/314432#858715
Roger Stafford
"Roger Stafford" wrote in message <ja1f47$96s$1@newscl01ah.mathworks.com>...<br>
> "Matt J" wrote in message <ja1a92$n0j$1@newscl01ah.mathworks.com>...<br>
> > I don't see how that can be true, Roger.<br>
> Yes, the statement I made is quite true, Matt. It is a fundamental theorem in <br>
       <br>
Afterword: A "screw" type transformation of the Chasles type could be written as:<br>
<br>
y = R*(xa)+b<br>
<br>
where the axis of (homogeneous) rotation matrix R is parallel to the vector ba, and a and b are points along the (offset) axis of rotation.<br>
<br>
Roger Stafford

Thu, 17 Nov 2011 16:44:29 +0000
Re: Center of Rotation in 3D motion
http://www.mathworks.com/matlabcentral/newsreader/view_thread/314432#858803
Serkan
Thank you guys!

Tue, 22 Nov 2011 20:39:08 +0000
Re: Center of Rotation in 3D motion
http://www.mathworks.com/matlabcentral/newsreader/view_thread/314432#859237
pixar
"Serkan" wrote in message <ja3dld$hrd$1@newscl01ah.mathworks.com>...<br>
> Thank you guys!<br>
<br>
Hi Serkan,<br>
<br>
could you find a suitable solution for finding the rotation center?<br>
<br>
It would be kind if you could post any hints about the algo to develop<br>
<br>
Thanks

Fri, 13 Jun 2014 14:18:12 +0000
Re: Center of Rotation in 3D motion
http://www.mathworks.com/matlabcentral/newsreader/view_thread/314432#923756
Ekrem
Hi <br>
<br>
I have a complicated problem. I have a cylindrical 3D body I can show three dimensional. Now I want to rotate this 3D body in its own axis by a certain degree. This I would like to then control via a slider in Matlab GUI.<br>
<br>
Problem description: I do not want that rotates the whole picture. I import a cylindrical STL file and plotte the whole thing with the function trisurf. This body I do not want to rotate as a whole image or chart but the body rotate about its own axis at a certain angle. And all I want to then control via slider (with MatlabGUI) that I give an angle in the text box and the component rotates about its axis at the desired angle.<br>
<br>
Thank you in advance for your help.<br>
<br>
Best regards