Path: news.mathworks.com!not-for-mail 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$1@newscl01ah.mathworks.com> References: <j9vf76$e5v$1@newscl01ah.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-02-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1321473133 2692 172.30.248.47 (16 Nov 2011 19:52:13 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Wed, 16 Nov 2011 19:52:13 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:749583 "Serkan" wrote in message <j9vf76$e5v$1@newscl01ah.mathworks.com>... > 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: http://en.wikipedia.org/wiki/Kabsch_algorithm 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: http://en.wikipedia.org/wiki/Rotation_matrix 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