Hello,
   I too have seen an effect of computation errors after successive matrix multiplications.  I wrote some simple code to rotate a transformgroup 90 degrees about an axis.  I call the code when I click a button.  If I click the button a bunch, I suddenly get a zoom effect and the program dumps a bunch of errors.
 
Sean
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Ken Warner
Sent: Tuesday, February 23, 1999 11:34 AM
To: [EMAIL PROTECTED]
Subject: [java3d] Computation errors in Transform3D

Hi,

It's to be expected that repeated matrix multiplications will sooner or later produce
computation errors when those multiplications are applied to Matrix{3,4}{d,f}.

I have a small demo program that shows that this happens fairly rapidly when doing
the following:

 void valuator1_AdjustmentValueChanged(java.awt.event.AdjustmentEvent event)
 {
//valuator1 sets values from 0 to 359 degrees and that is converted to radians -- I think.

  valuatorCanvas1.repaint();
  int value = event.getValue();
  double radians = (Math.PI / 180.0) * (double)value;
  System.out.println("Radians = " + radians);
  sceneGraph.setTransform3DRotX(radians);
 }

//lastrx holds the previous rotation in radians. The difference between
//the last value and the current value of rx is the new angle of rotation.
//this works fine for a while.  Then computation errors crop up.

 private double lastrx = 0.0;
 public void setTransform3DRotX(double rx)
 {

  Transform3D t = new Transform3D();
  Matrix3d rotmat = new Matrix3d();
  t.rotX(rx - lastrx);
  lastrx = rx;
  objTG.getTransform(objTrans);
  objTrans.mul(t,objTrans);
  objTG.setTransform(objTrans);
 }

Doing the above operation repeatedly on all axies will soon produce errors in objTrans that
show when the rotation of objTrans is set to [0.0, 0.0, 0.0].

If anyone is interested in seeing this demo, email me and I'll send you a zip with source.

Ken Warner

Reply via email to