I have also noticed the exact same similar bug in java-3d
As far as I can see there is an error in Transform3D,
when you try and get a 3x3 rotation matrix.
If you pass a matrix3f or matrix3d ,
and try get
if the Transform3D is in a dirty ,
it will try and compensate and
renormalize. It tries some kind
of scaled singular value decomposition,
and messes it up.
e.g.
transform3d.get ( matrix3f ) ;
will sometimes not copy the rotation matrix, if the transform3d, is in a dirty
state.
But
transform3d.getRotationScale ( matrix3f ) ; will return the proper rotation
matrix.
if you use a matrix4f, it also avoids the problem.
if you try
transTemp.getRotationScale (tempRotationMatrix);
it should work.
Get the vector separately then
Andrew Phelps wrote:
> Java 3D gurus, can you help me....
>
> I have developed a small J3D application which displays a marine structure
> in a given seaway. The application is a basic media player which alters the
> marine structure and wave-carpet through time, while allowing the user to
> transform the view (independent of the dynamically changing scene).
> Everything seems to work fine, except for two buttons which allow the user
> to 'zoom in and out' of the scene. (This is also done with a mouse
> behaviour which works fine, but I decided to include zoom buttons for users
> without a 3 button mouse).
> My scene-graph is as follows:
>
> ROOT
> / \
> scale lighting etc
> |
> transMouse (TG)
> / \
> waveTransformG boatTransformG
> | |
> wave(shape3D) boat(shape3D)
>
> When the user clicks on zoom-in or out button I get the mouse behaviour's
> transform matrix, alter the translation of the matrix, and re-set it.
> This, however, SOMETIMES changes the rotation, giving an undesirable view.
> I cannot understand why this is happening. Am I doing something
> fundamentally wrong?
> The method which changes the translation is as follows (I'm new to JAVA, so
> excuse bad style):
>
> public void zoomIn(float zoomAmount){
>
> Transform3D transTemp = new Transform3D();
> Matrix3f tempRotationMatrix = new Matrix3f();
> Vector3f tempTranslationVector = new Vector3f();
> float[] tempTranslationArray = new float[3];
>
> transMouse.getTransform(transTemp);
> transTemp.get(tempRotationMatrix, tempTranslationVector);
> tempTranslationVector.get(tempTranslationArray);
> tempTranslationArray[2] = tempTranslationArray[2] + zoomAmount;
> tempTranslationVector.set(tempTranslationArray);
> transTemp.set(tempRotationMatrix, tempTranslationVector, 1.0f);
> transMouse.setTransform(transTemp);
> }
>
> Is this the incorrect way of doing this?...Any ideas or suggestions would be
> most welcome.
>
> If you want to see where the application is going wrong you can download it
> from:
>
> http://www.wsatkins.co.uk/asas-aqwa/download/aqwa_sequence_java_download.htm
>
> Much appreciated,
>
> Andy Phelps
>
> ===============================================================
> WS Atkins Engineering Software
> Woodcote Grove
> Ashley Road Tel: +44 (0)1372 726 140
> Epsom Fax: +44 (0)1372 740 055
> Surrey URL:
> http://www.wsatkins.co.uk/wsa/core-pages/software.htm
> KT18 5BW E-mail: [EMAIL PROTECTED]
> England
> ===============================================================
>
> date sent: 01/04/99 16:29 (QA purposes)
>
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 3D Home Page: http://java.sun.com/products/java-media/3D/
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/