Hey Gary,

I liked your solution but unfortunately it didn't work.  The cylinder
whose endpoints are at the two vectors, did not rotate itself to the
endpoints.  It *did* rotate in three-space.... but not to the right
points.

If I find some time, I'll post a short demo using your method.  Maybe the
rotational transform and the original vectors aren't using the coordinate
system in some way.

-- John


On Sun, 30 Sep 2001, John Nelson wrote:

> Date: Sun, 30 Sep 2001 23:45:20 -0400
> From: John Nelson <[EMAIL PROTECTED]>
> Reply-To: Discussion list for Java 3D API <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: [JAVA3D] How to rotate objects?
>
> Thanks Gary,
>
> 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:
>
> > 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/
>
> _________________________________________________________
>
>
>

--
_____________________________________________________

John T. Nelson
President               |    Computation.com Inc
mail:                   |    [EMAIL PROTECTED]
company:                |    http://www.computation.com/
journal of computation: |    http://www.computation.org/
_____________________________________________________
"Providing quality IT consulting services since 1992"

===========================================================================
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