Very like Gary's solution!

This is something I'll have to explore and learn from.

Thanks all for the helpful replies....

-- John


Mark Hood wrote:
[EMAIL PROTECTED]">
Date:         Sun, 30 Sep 2001 22:54:50 -0400
From: John Nelson <[EMAIL PROTECTED]>

Nope.... this isn't what I've said. I have as a starting point, a pair of
points in space that define the orientation of an object. Think of them
as the endpoints of a cylinder. The goal is to rotate that cylinder
so that the ends of the cylinder are at the pair of points.

Decide which endpoint of the cylinder should map to one of the pair of target
points. Subtract that from the other endpoint of the cylinder to get a vector
and then normalize it. Do the same for the other pair of points.

Take the cross product of the two vectors to get a vector normal to them both.
Take the inverse sine of the length of this vector to get the rotation angle
between them. If the length of the cross product vector is zero both vectors
are already co-aligned; otherwise normalize the cross product vector to get the
axis of rotation.

Use the angle and rotation axis to create a javax.vecmath.AxisAngle4f. Then
feed this into either the set() or setRotation() methods of Transform3D to get
a matrix which rotates one vector to the other. Multiply that transform by a
translation which moves the base points of both your original vectors together.

-- Mark Hood

==========================! =================================================
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".


--
_________________________________________________________

John T. Nelson
President       |      Computation.com Inc.
mail:           |      [EMAIL PROTECTED]
company:        |      http://www.computation.com/
journal:        |      http://www.computation.org/

_________________________________________________________

Reply via email to