From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Center of Rotation in 3D motion
Date: Wed, 16 Nov 2011 19:52:13 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <ja149d$2k4$>
References: <j9vf76$e5v$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1321473133 2692 (16 Nov 2011 19:52:13 GMT)
NNTP-Posting-Date: Wed, 16 Nov 2011 19:52:13 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:749583

"Serkan" wrote in message <j9vf76$e5v$>...
> I have a set of 3D marker data attached on a body that rotates around a semi-constrained joint. I would like to find the center of rotation in three-dimensional coordinate system (x,y,z). Do you know any matlab codes for this calculation? 
> Thanks a bunch!
- - - - - - - - -
  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?

  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.

  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:

The equivalent can also be done using the Statistics Toolbox function 'procrustes' appropriately.  See its documentation.

  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:

using matlab's 'eig' function.

  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.

Roger Stafford