GeomConverter/test/org/lcsim/detector/kernel
diff -u -r1.1 -r1.2
--- Rotation3DTest.java 23 Feb 2007 21:47:48 -0000 1.1
+++ Rotation3DTest.java 24 Feb 2007 00:30:42 -0000 1.2
@@ -26,16 +26,51 @@
Rotation3D rotation = new Rotation3D();
assert(rotation.getMatrix().trace() == 3.0);
}
-
+
public void testSimpleRotationX()
{
- Hep3Vector coordinate = new BasicHep3Vector(0.0,1.0,0.0);
+ Hep3Vector coordinate = new BasicHep3Vector(1.0,0.0,0.0);
Rotation3D rotation = new Rotation3D();
- rotation.setPassiveEuler(Math.PI / 2, 0, 0);
+ rotation.setTaitBryan(Math.PI / 2, 0, 0);
Hep3Vector result = VecOp.mult(rotation.getMatrix(),coordinate);
System.out.println("90 degree X rotation");
rotation.printOut(System.out);
System.out.printf("original point -> ( %.4f %.4f %.4f ) \n",coordinate.x(),coordinate.y(),coordinate.z());
System.out.printf("rotated 90 deg -> ( %.4f %.4f %.4f ) \n",result.x(),result.y(),result.z());
+ rotation.invert();
+ result = VecOp.mult(rotation.getMatrix(),result);
+ System.out.printf("inverse rotated 90 deg -> ( %.4f %.4f %.4f ) \n",result.x(),result.y(),result.z());
+
}
+
+ public void testSimpleRotationY()
+ {
+ Hep3Vector coordinate = new BasicHep3Vector(1.0,0.0,0.0);
+ Rotation3D rotation = new Rotation3D();
+ rotation.setTaitBryan(0, Math.PI / 2, 0);
+ Hep3Vector result = VecOp.mult(rotation.getMatrix(),coordinate);
+ System.out.println("90 degree Y rotation");
+ rotation.printOut(System.out);
+ System.out.printf("original point -> ( %.4f %.4f %.4f ) \n",coordinate.x(),coordinate.y(),coordinate.z());
+ System.out.printf("rotated 90 deg -> ( %.4f %.4f %.4f ) \n",result.x(),result.y(),result.z());
+ rotation.invert();
+ result = VecOp.mult(rotation.getMatrix(),result);
+ System.out.printf("inverse rotated 90 deg -> ( %.4f %.4f %.4f ) \n",result.x(),result.y(),result.z());
+ }
+
+ public void testSimpleRotationZ()
+ {
+ Hep3Vector coordinate = new BasicHep3Vector(1.0,0.0,0.0);
+ Rotation3D rotation = new Rotation3D();
+ rotation.setTaitBryan(0, 0, Math.PI / 2);
+ Hep3Vector result = VecOp.mult(rotation.getMatrix(),coordinate);
+ System.out.println("90 degree Z rotation");
+ rotation.printOut(System.out);
+ System.out.printf("original point -> ( %.4f %.4f %.4f ) \n",coordinate.x(),coordinate.y(),coordinate.z());
+ System.out.printf("rotated 90 deg -> ( %.4f %.4f %.4f ) \n",result.x(),result.y(),result.z());
+ rotation.invert();
+ result = VecOp.mult(rotation.getMatrix(),result);
+ System.out.printf("inverse rotated 90 deg -> ( %.4f %.4f %.4f ) \n",result.x(),result.y(),result.z());
+ }
+
}
\ No newline at end of file