I had thought that AxisAngle4d might be one way to achieve the goal, but I just couldn't see it. I'll have to take a closer look at your example.
Again thanks a lot and all the best...
-- John
Gary L. Graf wrote:
[EMAIL PROTECTED]">Try this to get a Transform3D that you can use to move your points. You can
then apply the transform to a TransformGroup to rotate you points. Similarly,
you can generate a Matrix3d and move the points before sending them to the
rendering pipeline. That may be more efficient (eg. change the geometry once
rather than compute a rotation every pass) depending on the circumstances.
Realize, this code is set up presuming the rotation is about the same origin
point as you used in your definition of the object endpoints. If the rotation
point is different you will observe some odd jumps in the view. That is easy
to fix by translation of the endpoints to the correct reference origin before
computing the rotation axis.
--------------------------------------------------------------------
//Define end points as new vectors
Vector3d fromDir = new Vector3d! (fromPoint);
Vector3d toDir = new Vector3d(toPoint);
//Compute the value of the angle between them (no spatial orientation
info though)
double rotInRadians = fromDir.angle(toDir);
//Compute an orthagonal vector to later define the rotation axis
(orientation info)
Vector3d orthagonalAxis = new Vector3d();
orthagonalAxis.cross(fromDir, toDir);
orthagonalAxis.normalize();
//Create new rotation matrix
AxisAngle4d rotAxis = new AxisAngle4d(orthagonalAxis, rotInRadians);
Transform3D resultantTransform = new Transform3D();
resultantTransform.setRotation(rotAxis);
Hope this helps - Gary Graf
-- _________________________________________________________
John T. Nelson President | Computation.com Inc. mail: | [EMAIL PROTECTED] company: | http://www.computation.com/ journal: | http://www.computation.org/ _________________________________________________________
