Subject: quaternions from direction cosine matrix?

From: "Gustavo A. Mercier Jr" <[email-masked]>
Date: Fri, 10 Jan 1997 07:58:52 -0500 (EST)

Hi!

I need assistance with the following problem that arises in rigid
body dynamics.

Molecular rotations can be described using quaternions rather than
Euler angles with the advantage that the equations are well behaved.

To specify the initial configuration I need the center of mass
and the quaternions describing the orientation of the molecules.

I can get the direction cosine matrix from a diagonalization of
the Moment of Inertia Matrix. After I specify a given convention
for the Euler angles (eg. x convention in the Allen and Tidsley book),
 I get a relationship between this matrix and the matrix specified
in terms of quaternions. (See Allen and Tidsley.)

Problem: In solving for the quaternions (qo,q1,q2,q3), I get equations
for the square of the quaternions (qo**2, q1**2, q2**2, q3**2).
Obviously, this leaves the sign undefined. That is the problem!

Question: How do you define the sign of the quaternion knowing the values
of the direction cosine matrix and not the actual Euler angles?

Any assistance would be appreciated. The goal here is to filter Amber output
in to the program Moldy. If anybody is interested in this filter I will
gladly make it public once it is coded and tested.

Thanks for the assistance!

-- 
                                      ("`-/")_.-'"``-._
Gustavo A. Mercier,Jr.,MD,PhD         (. . `) -._    )-;-,_() 
Division of Nuclear Medicine          (v_,)'  _  )`-.\  ``-
Dept. of Radiology                    _;- _,-_/ / ((,'
University of Pennsylvania           ((,.-'  ((,/
3400 Spruce St.                  [email-masked]
Philadelphia, PA 19104         215-662-3069/3091 fax: 215-349-5843

---

From: Roger Critchlow <[email-masked]>
Date: Fri, 10 Jan 1997 10:52:33 -0800 (PST)

> of the direction cosine matrix and not the actual Euler angles?

Possibly my favorite formula:  given two unit vectors, u and v, the
quaternion, q, formed from:

	scalar_part(q) = vector_dot_product(u,v)
	vector_part(q) = vector_cross_product(u,v)

is a unitary quaternion which rotates the vector u in the plane
defined by u and v by twice the signed angle from u to v.

So to construct a quaternion which rotates a unit vector u into a unit
vector w, one need only construct a unit vector v which bisects the
angle between u and w.

-- rec --