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