From: "Bob Dengle" <[EMAIL PROTECTED]>
Sent: Saturday, July 07, 2001 1:40 AM


> Hi
>
> I have two vector3ds. I want to rotate one so that it falls
along the same
> line as the other. Does anyone have any suggestions on how to
do this? I
> know how to compute the angle between the two vectors, but how
do I go from
> there to a rotation matrix? Thanks in advance.

Bob,  Try this.

1.) Normalize both vectors. 2.)Take the cross product in the
order you want.  The result is a unit vector along the desired
axis of rotation, scaled by the sin of the rotation angle.
Sound familiiar?  It's the vector component of the quaternion
you need to define the Transform3D.  3.) The fourth (scalar)
part of the quaternion is just whatever you need to normalize
the quat - the square root of one minus the norm of the cross
product.  Then
4.) Transform3D t3d = new Transform3D(quat /*for rotation*/, new
Vector3d(0.0, 0.0, 0.0) /*for translation*/, 1.0/*for scale*/);

Cheers,

Fred Klingener
Brock Engineering


>
> B.D.
>
________________________________________________________________
_
> Get your FREE download of MSN Explorer at
http://explorer.msn.com
>
>
================================================================
===========
> To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body
> of the message "signoff JAVA3D-INTEREST".  For general help,
send email to
> [EMAIL PROTECTED] and include in the body of the message
"help".
>
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to