I think that youve missed the point.
 
The general purpose 3D rotation requires 3 translations.
 
A pre translation to shift the axis of rotation onto the origin
The rotation
Then an equal and opersite post translation to shift the the centre of rotation back to its original position
 
The method in the code snipet can be used to set one of the translations (in practice the pre one)
 
Its the second one that requires a whole separate Transform3D to be set up and multiplied
-----Original Message-----
From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED]]On Behalf Of Glenn Rowe
Sent: 07 September 2000 12:45
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Transform3D controls for general purpose rotation missing?

The only solution I found to this problem was to use a Transform3D. The following code
snippet is from a program that draws a box with a hinged lid. The rotation axis of the lid
is parallel to the x axis but passes through y = 1, so I used an AxisAngle4f to create
the horizontal axis and then combined this with a translation to get the axis where it's
needed:
 
    AxisAngle4f angle = new AxisAngle4f(0.0f, 0.0f, 1.0f, (float)Math.PI/2.0f);
    Transform3D rotAxis = new Transform3D();
    rotAxis.set(angle);
    rotAxis.setTranslation(new Vector3d(0.0, 1.0, 0.0));
But I agree, it would be nice to able to do the whole thing at once.
Hi
 
I'm probably missing something here...........
 
I needed to rotate about an arbitrary axis i.e. about a vector (direction) through a point (origin) by angle (angle)
 
if the point passes through the origin I can say
 
                    aTransform3D.setRotation(new AxisAngle4f(direction, angle));
 
but that's a rather special case.  AxisAngle seems a bit useless if it can't handle any axis that doesn't pass through the origin.
 
So I end up having set up the transforms for the shift to the origin, the rotate, and the shift back and multiply them up myself.
 
Which is fine But....  Unless there is another handle that I haven't found, then can I suggest that AxisAngle should hold a general axis of rotation so that something like
 
                    aTransform3D.setRotation(new AxisAngle7f(origin, direction, angle));
 
And yes, I know I can do it myself, but these basic Transform3D facilities
 
 
    Alex Bowden
        [EMAIL PROTECTED]
 
 
 

 

Reply via email to