Index: src/com/xith3d/scenegraph/Transform3D.java =================================================================== RCS file: /cvs/xith3d/src/com/xith3d/scenegraph/Transform3D.java,v retrieving revision 1.6 diff -u -r1.6 Transform3D.java --- src/com/xith3d/scenegraph/Transform3D.java 3 Aug 2003 23:18:26 -0000 1.6 +++ src/com/xith3d/scenegraph/Transform3D.java 19 Aug 2003 01:35:48 -0000 @@ -146,9 +146,32 @@ * elements of this transform are unchanged. */ public final void setRotation(Matrix3f m) { - matrix.set(m); + matrix.setRotation(m); } + /** + * Rotates the matrix around the passed axis by the passed angle. + * Non rotational elements are unchanged. + * @param a1 Rotation amount and axis of rotation + */ + public final void setRotation(AxisAngle4f a1) { + + // Extracts the axis + Vector3f axis = new Vector3f(a1.x, a1.y, a1.z); + + // Extracts the angle + float angle = a1.angle; + + // Calculates the rotation matrix by rotating a Transform + Transform3D rotation = new Transform3D(); + Matrix3f rotationMatrix = new Matrix3f(); + rotation.rotAxis(axis, angle); //performs the rotation + rotation.getRotation(rotationMatrix); //extracts the rotation + + // Applies rotation matrix to the current Transform3D + setRotation(rotationMatrix); + } + /** * Copy the rotation, the upper 3x3 matrix values of this transform * into the Matrix3f m.