From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Rotate 3D object to align with x-y plane
Date: Wed, 11 May 2011 18:27:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 33
Message-ID: <iqekdm$8hq$>
References: <ip7abl$p2g$> <ip9d1c$29t$> <ip9j6d$kmc$> <iqebkk$d1c$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1305138422 8762 (11 May 2011 18:27:02 GMT)
NNTP-Posting-Date: Wed, 11 May 2011 18:27:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:726245

"Matt J" wrote in message <iqebkk$d1c$>...
> .......
> And therefore your approach needs to be modified from a pure rotation to an affine transform, no?  ........
- - - - - - - - -
  No, Matt, that isn't true.  Remember that an assumption was made by Greg that "the origin is at the center of gravity of the three points" and weakened by me to simply that the origin is "to lie somewhere in the triangle's plane".  With either of these assumptions, the pure rotation R will bring the three points into the xy-plane.

  Here's an example.  It is easy to show that the three points of the rows of xyz are coplanar with the origin - the volume of the tetrahedron they form with the origin is zero.

xyz =

   1.03072751719372   1.03710039288023  -0.47172543062421
  -1.28711731083625  -0.84785872257114  -0.24727209937913
  -0.54211111717983   0.36846849121402  -1.46103428529782

The resulting R and xyz2 from my code are:

R =

                  0  -0.83020044023651   0.55746500251685
  -0.47154841677308  -0.49159503423629  -0.73210409980618
   0.88184017295585  -0.26287173934322  -0.39147970319783

xyz2 =

  -0.90502948362674  -1.24154055724192   0.00000000000000
   0.18175196739202   1.55036934269703  -0.00000000000000
  -1.46214946050419   0.65298823140276  -0.00000000000000

The determinant of R is +1, so it is a pure rotation and it has brought the three points into the x-y plane.  In fact it is, of necessity, a rotation, as I pointed out, about "some line through the origin and lying in the plane bisecting the dihedral angle between the triangle's plane and the x-y plane."

  (Note that there was a typo in my original code with 'xys' being in place of 'xyz' at one point.)

Roger Stafford