Print

Print


Commit in GeomConverter/test/org/lcsim/detector on MAIN
Rotation3DTest.java+20-51.2 -> 1.3
Improvements to basic test cases for rotations.

GeomConverter/test/org/lcsim/detector
Rotation3DTest.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- Rotation3DTest.java	26 Feb 2007 19:41:43 -0000	1.2
+++ Rotation3DTest.java	26 Feb 2007 23:42:54 -0000	1.3
@@ -31,11 +31,11 @@
         
     public void testSimpleRotationX()
     {
-    	Hep3Vector coordinate = new BasicHep3Vector(1.0,0.0,0.0);
+    	Hep3Vector coordinate = new BasicHep3Vector(0.0,0.0,1.0);
     	Rotation3D rotation = new Rotation3D();
     	rotation.setTaitBryan(Math.PI / 2, 0, 0);
     	Hep3Vector result = VecOp.mult(rotation.getRotationMatrix(),coordinate);
-    	System.out.println("90 degree X rotation");
+    	System.out.println("90 degree X rotation: Y'=Z");
     	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());
@@ -50,7 +50,7 @@
     	Rotation3D rotation = new Rotation3D();
     	rotation.setTaitBryan(0, Math.PI / 2, 0);
     	Hep3Vector result = VecOp.mult(rotation.getRotationMatrix(),coordinate);
-    	System.out.println("90 degree Y rotation");
+    	System.out.println("90 degree Y rotation: Z'=X");
     	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());
@@ -61,11 +61,26 @@
         
     public void testSimpleRotationZ()
     {
-    	Hep3Vector coordinate = new BasicHep3Vector(1.0,0.0,0.0);
+    	Hep3Vector coordinate = new BasicHep3Vector(0.0,1.0,0.0);
     	Rotation3D rotation = new Rotation3D();
     	rotation.setTaitBryan(0, 0, Math.PI / 2);
     	Hep3Vector result = VecOp.mult(rotation.getRotationMatrix(),coordinate);
-    	System.out.println("90 degree Z rotation");
+    	System.out.println("90 degree Z rotation: X'=Y");
+    	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.getRotationMatrix(),result);
+        System.out.printf("inverse rotated 90 deg -> ( %.4f %.4f %.4f ) \n",result.x(),result.y(),result.z());
+    }
+    
+    public void testRotationXYZ()
+    {
+    	Hep3Vector coordinate = new BasicHep3Vector(1.0,2.0,3.0);
+    	Rotation3D rotation = new Rotation3D();
+    	rotation.setTaitBryan(Math.PI/2, Math.PI/2, Math.PI/2);
+    	Hep3Vector result = VecOp.mult(rotation.getRotationMatrix(),coordinate);
+    	System.out.println("Sequential 90 degree rotations in X,Y,Z: X'=Z, Y'=-Y ,Z'=X");
     	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());
CVSspam 0.2.8