Hi Kasparian,
This exception throws if the Transform3D matrix set
is not congruent. i.e. not an orthogonal matrix with same x/y/z scale
Internally, we classify the matrix using precision
about 1.0e-5 when doing comparision. In your case
a congruent matrix is invert() and hope
that the resulting one is also congruent as in the
ideal case. But there may be some degenerate case that cause
the invert() numerically unstable to produce another
matrix with precision fall within the range that
Transform3D check for congruent.
To workaround, you may need to catch the Exception
and handle this case specially e.g.
try {
tg.setTransform(t3d) ;
} catch (BadTransformException e) {
t3d.normalize(); // make it orthogonal
t3d.setScale(t3d.getScale()); //set x/y/z same scale
tg.setTransform(t3d); // do it again, this time should work
}
Note that doing
T.setRotation( quat );
is faster than
AxisAngle4d aa = new AxisAngle4d();
aa.set( quat );
T.setRotation( aa );
because (1) Less computation
(2) Lots of GC to new AxisAngle4d() every time.
Hope this help.
- Kelvin
----------------
Java 3D Team
Sun Microsystems Inc.
>
>A bug that I first noticed with Java3D 1.1.3 is still present in Java3D
>1.3b1. When manipulating Transform3Ds above the ViewPlatform, using
>Transform3D.setRotation( Quat4d ) can produce the following error while
>Transform3D.setRotation( AxisAngle4d ) does not.
>
>javax.media.j3d.BadTransformException: non-congruent transform above
>ViewPlatform
> at
>javax.media.j3d.TransformGroupRetained.setTransform(TransformGroupRetained.j
>ava:138)
> at
>javax.media.j3d.TransformGroup.setTransform(TransformGroup.java:111)
> at orbiter.OrbiterViewer$1.processStimulus(OrbiterViewer.java:75)
> at
>javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:174)
> at javax.media.j3d.J3dThread.run(J3dThread.java:256)
>
>Surely this shouldn't be. Sun Programmers, can you determine what the
>problem might be? I should think that this is enough information but to give
>you a bit more context, here is the method in question:
>
>protected void placeViewer(){
> boolean useQuat = true;
> Transform3D T = new Transform3D();
> mySphereTG.getTransform( T );
> Quat4d quat = new Quat4d();
> T.get( quat );
> quat.inverse();
> viewerTG.getTransform( T );
> if( useQuat ){
> T.setRotation( quat );//sometimes crash
> }else{
> AxisAngle4d aa = new AxisAngle4d();
> aa.set( quat );
> T.setRotation( aa );
> }
> viewerTG.setTransform( T );
>}
>
>Thanks,
>
>Raffi
>
>===========================================================================
>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".
===========================================================================
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".