Print

Print


Commit in GeomConverter on MAIN
test/org/lcsim/detector/ShapeRotateTest.java+4-61.6 -> 1.7
                       /Rotation3DTest.java+6-91.5 -> 1.6
                       /Transform3DTest.java+29-341.1 -> 1.2
                       /SimpleDetectorTest.java+2-21.15 -> 1.16
src/org/lcsim/detector/converter/compact/CylindricalEndcapCalorimeterConverter.java+8-91.8 -> 1.9
                                        /SiTrackerBarrelConverter.java+16-141.20 -> 1.21
                                        /DiskTrackerConverter.java+7-81.10 -> 1.11
test/org/lcsim/detector/solids/TrdTest.java+10-71.2 -> 1.3
src/org/lcsim/detector/ITranslation3D.java+33added 1.1
                      /RotationGeant.java+48added 1.1
                      /RotationPassiveXYZ.java+35added 1.1
                      /Translation3D.java+68added 1.1
                      /RotationPassiveEuler.java+35added 1.1
                      /PhysicalVolume.java+1-11.8 -> 1.9
                      /IRotation3D.java+51-1071.8 -> 1.9
                      /Transform3D.java+35-361.4 -> 1.5
                      /Rotation3D.java+206-4411.10 -> 1.11
                      /ITransform3D.java+64-61.1 -> 1.2
Commit in lcsim/src/org/lcsim/contrib/SiStripSim on MAIN
CDFSiSensorSim.java+3-31.4 -> 1.5
Commit in GeomConverter on MAIN
src/org/lcsim/detector/tracker/silicon/SiSensor.java+1-21.11 -> 1.12
+662-685
5 added + 15 modified, total 20 files
Complete rework of coordinate transformations, rotations, translations and changes to dependent classes.

GeomConverter/test/org/lcsim/detector
ShapeRotateTest.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- ShapeRotateTest.java	10 Apr 2007 03:17:27 -0000	1.6
+++ ShapeRotateTest.java	7 Aug 2007 18:11:39 -0000	1.7
@@ -85,9 +85,8 @@
         
         Box box2 = new Box("box2", 10,10,10);
         ILogicalVolume lv2 = new LogicalVolume("test2",box2,dummymat);
-        Hep3Vector t1 = new BasicHep3Vector(25,0,0);
-        Rotation3D r1 = new Rotation3D();
-        r1.setPassiveXYZ(0, 0, Math.PI/8);
+        ITranslation3D t1 = new Translation3D(25,0,0);
+        IRotation3D r1 = new RotationPassiveXYZ(0, 0, Math.PI/8);
         
         IPhysicalVolume pv1 = 
             new PhysicalVolume(
@@ -106,10 +105,9 @@
         
         for (int i=0; i<5; i++)
         {
-            Rotation3D thisRot = new Rotation3D();
-            thisRot.setPassiveXYZ(0, 0, rotZ);
+            IRotation3D thisRot = new RotationPassiveXYZ(0, 0, rotZ);
             
-            Hep3Vector thisTrans = new BasicHep3Vector(transX,0,0);
+            ITranslation3D thisTrans = new Translation3D(transX,0,0);
             
             IPhysicalVolume pv =
                 new PhysicalVolume(

GeomConverter/test/org/lcsim/detector
Rotation3DTest.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- Rotation3DTest.java	16 May 2007 23:27:38 -0000	1.5
+++ Rotation3DTest.java	7 Aug 2007 18:11:39 -0000	1.6
@@ -1,6 +1,7 @@
 package org.lcsim.detector;
 
-import org.lcsim.detector.Rotation3D;
+import org.lcsim.detector.IRotation3D;
+import org.lcsim.detector.RotationPassiveXYZ;
 
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
@@ -32,8 +33,7 @@
     public void testSimpleRotationX()
     {
     	Hep3Vector coordinate = new BasicHep3Vector(0.0,0.0,1.0);
-    	Rotation3D rotation = new Rotation3D();
-    	rotation.setPassiveXYZ(Math.PI / 2, 0, 0);
+    	IRotation3D rotation = new RotationPassiveXYZ(Math.PI / 2, 0, 0);
     	Hep3Vector result = VecOp.mult(rotation.getRotationMatrix(),coordinate);
     	System.out.println("90 degree X rotation: Y'=Z");
     	rotation.printOut(System.out);
@@ -47,8 +47,7 @@
     public void testSimpleRotationY()
     {
     	Hep3Vector coordinate = new BasicHep3Vector(1.0,0.0,0.0);
-    	Rotation3D rotation = new Rotation3D();
-    	rotation.setPassiveXYZ(0, Math.PI / 2, 0);
+    	IRotation3D rotation = new RotationPassiveXYZ(0, Math.PI / 2, 0);
     	Hep3Vector result = VecOp.mult(rotation.getRotationMatrix(),coordinate);
     	System.out.println("90 degree Y rotation: Z'=X");
     	rotation.printOut(System.out);
@@ -62,8 +61,7 @@
     public void testSimpleRotationZ()
     {
     	Hep3Vector coordinate = new BasicHep3Vector(0.0,1.0,0.0);
-    	Rotation3D rotation = new Rotation3D();
-    	rotation.setPassiveXYZ(0, 0, Math.PI / 2);
+    	IRotation3D rotation = new RotationPassiveXYZ(0, 0, Math.PI / 2);
     	Hep3Vector result = VecOp.mult(rotation.getRotationMatrix(),coordinate);
     	System.out.println("90 degree Z rotation: X'=Y");
     	rotation.printOut(System.out);
@@ -77,8 +75,7 @@
     public void testRotationXYZ()
     {
     	Hep3Vector coordinate = new BasicHep3Vector(1.0,2.0,3.0);
-    	Rotation3D rotation = new Rotation3D();
-    	rotation.setPassiveXYZ(Math.PI/2, Math.PI/2, Math.PI/2);
+    	IRotation3D rotation = new RotationPassiveXYZ(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);

GeomConverter/test/org/lcsim/detector
Transform3DTest.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- Transform3DTest.java	30 Mar 2007 23:26:54 -0000	1.1
+++ Transform3DTest.java	7 Aug 2007 18:11:39 -0000	1.2
@@ -1,7 +1,10 @@
 package org.lcsim.detector;
 
 import org.lcsim.detector.Transform3D;
-import org.lcsim.detector.Rotation3D;
+import org.lcsim.detector.ITranslation3D;
+import org.lcsim.detector.Translation3D;
+import org.lcsim.detector.IRotation3D;
+import org.lcsim.detector.RotationPassiveXYZ;
 
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.VecOp;
@@ -29,12 +32,11 @@
     
     public void testSimpleTransform()
     {        
-        Rotation3D r1 = new Rotation3D();
-        r1.setPassiveXYZ(0, 0, PI/2);
+        IRotation3D r1 = new RotationPassiveXYZ(0, 0, PI/2);
         
-        Hep3Vector v1 = new BasicHep3Vector(10,0,0);
+        ITranslation3D v1 = new Translation3D(10,0,0);
         
-        Transform3D t1 = new Transform3D(v1,r1);
+        ITransform3D t1 = new Transform3D(v1,r1);
         
         Hep3Vector point = new BasicHep3Vector(1,0,0);
         
@@ -73,7 +75,7 @@
         double random_y = random.nextDouble();
         double random_z = random.nextDouble();
         
-    	Transform3D transformation = new Transform3D(new BasicHep3Vector(random_x,random_y,random_z));
+    	Transform3D transformation = new Transform3D(new Translation3D(random_x,random_y,random_z));
     	Hep3Vector point = new BasicHep3Vector(1.0,2.0,3.0);
 
     	Hep3Vector transformed_point = transformation.transformed(point);
@@ -93,16 +95,15 @@
     {
     	System.out.println("CoordinateTransformation3DTest.testSimpleRotationX");
     	
-    	Rotation3D rotateX = new Rotation3D();
-        
-    	rotateX.setPassiveXYZ(Math.PI / 2, 0, 0);
-    	Transform3D transformation = new Transform3D(rotateX);
+    	IRotation3D rotateX = new RotationPassiveXYZ(Math.PI / 2, 0, 0);
+
+        ITransform3D transformation = new Transform3D(rotateX);
 
     	Hep3Vector point = new BasicHep3Vector(0.0,0.0,1.0);
     	Hep3Vector result = transformation.transformed(point);
 
 //    	System.out.println("Transform");
-    	transformation.getRotation().printOut(System.out);
+    	((Rotation3D)transformation.getRotation()).printOut(System.out);
 //    	System.out.printf("new point = ( %.4f %.4f %.4f )\n",result.x(),result.y(),result.z());
     	//CoordinateTransformation3D.mult(point, transform);
     	//Hep3Rotation rotation = result.getRotation();    	
@@ -124,23 +125,21 @@
     	
         Random random = new Random();
         
-        Rotation3D rotation_1 = new Rotation3D();
-        rotation_1.setPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
-        Hep3Vector translation_1 = new BasicHep3Vector(random.nextDouble(),random.nextDouble(),random.nextDouble());
-        
-        Rotation3D rotation_2 = new Rotation3D();
-        rotation_2.setPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
-        Hep3Vector translation_2 = new BasicHep3Vector(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        IRotation3D rotation_1 = new RotationPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        ITranslation3D translation_1 = new Translation3D(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        
+        IRotation3D rotation_2 = new RotationPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        ITranslation3D translation_2 = new Translation3D(random.nextDouble(),random.nextDouble(),random.nextDouble());
 
-    	Transform3D transformation_1 = new Transform3D(translation_1,rotation_1);
-    	Transform3D transformation_2 = new Transform3D(translation_2,rotation_2);
+    	ITransform3D transformation_1 = new Transform3D(translation_1,rotation_1);
+    	ITransform3D transformation_2 = new Transform3D(translation_2,rotation_2);
        
         Hep3Vector point = new BasicHep3Vector(1.0,2.0,3.0);
         
         Hep3Vector transformed_point_1 = transformation_1.transformed(point);
         transformed_point_1 = transformation_2.transformed(transformed_point_1);
        
-        Transform3D transformation_product = Transform3D.multiply(transformation_2,transformation_1);
+        ITransform3D transformation_product = Transform3D.multiply(transformation_2,transformation_1);
         Hep3Vector transformed_point_2 = transformation_product.transformed(point);
         
         System.out.println("x_1: "+transformed_point_1.x()+"  x_2: "+transformed_point_2.x());
@@ -161,13 +160,11 @@
     	
         Random random = new Random();
         
-        Rotation3D rotation_1 = new Rotation3D();
-        rotation_1.setPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
-        Hep3Vector translation_1 = new BasicHep3Vector(random.nextDouble(),random.nextDouble(),random.nextDouble());
-        
-        Rotation3D rotation_2 = new Rotation3D();
-        rotation_2.setPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
-        Hep3Vector translation_2 = new BasicHep3Vector(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        IRotation3D rotation_1 = new RotationPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        ITranslation3D translation_1 = new Translation3D(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        
+        IRotation3D rotation_2 = new RotationPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        ITranslation3D translation_2 = new Translation3D(random.nextDouble(),random.nextDouble(),random.nextDouble());
 
     	Transform3D transformation_1 = new Transform3D(translation_1,rotation_1);
     	Transform3D transformation_2 = new Transform3D(translation_2,rotation_2);
@@ -199,9 +196,8 @@
     	
         Random random = new Random();
 
-        Rotation3D rotation = new Rotation3D();
-        rotation.setPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
-        Hep3Vector translation = new BasicHep3Vector(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        IRotation3D rotation = new RotationPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        ITranslation3D translation = new Translation3D(random.nextDouble(),random.nextDouble(),random.nextDouble());
     	Transform3D transformation = new Transform3D(translation,rotation);
         
         Hep3Vector point = new BasicHep3Vector(1.0,2.0,3.0);
@@ -228,9 +224,8 @@
     	
         Random random = new Random();
 
-        Rotation3D rotation = new Rotation3D();
-        rotation.setPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
-        Hep3Vector translation = new BasicHep3Vector(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        IRotation3D rotation = new RotationPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
+        ITranslation3D translation = new Translation3D(random.nextDouble(),random.nextDouble(),random.nextDouble());
 
     	Transform3D transformation = new Transform3D(translation,rotation);  
         Hep3Vector point = new BasicHep3Vector(1.0,2.0,3.0);        

GeomConverter/test/org/lcsim/detector
SimpleDetectorTest.java 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- SimpleDetectorTest.java	6 Aug 2007 19:09:32 -0000	1.15
+++ SimpleDetectorTest.java	7 Aug 2007 18:11:39 -0000	1.16
@@ -226,7 +226,7 @@
 		Box box2 = new Box("test_box2",5.0,5.0,5.0);
 		LogicalVolume lvTest2 = new LogicalVolume("lvTest2",box2,dummymat);
 		new PhysicalVolume(
-				new Transform3D(new BasicHep3Vector(50.0,0,0)),
+				new Transform3D(new Translation3D(50.0,0,0)),
 				"box2",
 				lvTest2,
 				mom.getLogicalVolume(),
@@ -236,7 +236,7 @@
 		Box box3 = new Box("test_box3",5.0,5.0,5.0);
 		LogicalVolume lvTest3 = new LogicalVolume("lvTest3",box3,dummymat);
 		new PhysicalVolume(
-				new Transform3D(new BasicHep3Vector(0,50.0,0)),
+				new Transform3D(new Translation3D(0,50.0,0)),
 				"box3",
 				lvTest3,
 				mom.getLogicalVolume(),

GeomConverter/src/org/lcsim/detector/converter/compact
CylindricalEndcapCalorimeterConverter.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- CylindricalEndcapCalorimeterConverter.java	9 May 2007 00:59:58 -0000	1.8
+++ CylindricalEndcapCalorimeterConverter.java	7 Aug 2007 18:11:39 -0000	1.9
@@ -1,14 +1,14 @@
 package org.lcsim.detector.converter.compact;
 
-import hep.physics.vec.BasicHep3Vector;
-
 import org.lcsim.detector.DetectorElement;
 import org.lcsim.detector.IDetectorElement;
 import org.lcsim.detector.ILogicalVolume;
 import org.lcsim.detector.IPhysicalVolume;
 import org.lcsim.detector.LogicalVolume;
 import org.lcsim.detector.PhysicalVolume;
-import org.lcsim.detector.Rotation3D;
+import org.lcsim.detector.IRotation3D;
+import org.lcsim.detector.RotationPassiveEuler;
+import org.lcsim.detector.Translation3D;
 import org.lcsim.detector.Transform3D;
 import org.lcsim.detector.material.IMaterial;
 import org.lcsim.detector.material.MaterialStore;
@@ -39,7 +39,7 @@
         // Positive endcap.
         IPhysicalVolume pv =
             new PhysicalVolume(
-                    new Transform3D(new BasicHep3Vector(0,0,zcenter)),
+                    new Transform3D(new Translation3D(0,0,zcenter)),
                     cal.getName() + "_positive",
                     envelope,
                     world.getLogicalVolume(),
@@ -57,13 +57,12 @@
         DetectorElement reflectedEndcap=null;
         if ( cal.getReflect() )
         {
-            Rotation3D reflect = new Rotation3D();
-            reflect.setPassiveEuler(Math.PI,0,0);
+            IRotation3D reflect = new RotationPassiveEuler(Math.PI,0,0);
                         
             new PhysicalVolume
             (
                     new Transform3D(
-                            new BasicHep3Vector(0,0,negz), 
+                            new Translation3D(0,0,negz), 
                             reflect
                             ),
                     cal.getName() + "_negative",
@@ -181,7 +180,7 @@
              
             new PhysicalVolume(
                     new Transform3D(
-                            new BasicHep3Vector( 0, 0, zLayer+layer.getThickness() / 2 ) ),
+                            new Translation3D( 0, 0, zLayer+layer.getThickness() / 2 ) ),
                     "layer"+i,
                     lvLayer,
                     envelope,
@@ -209,7 +208,7 @@
                 zSlice += slice.getThickness()/2;
                 
                 new PhysicalVolume(
-                        new Transform3D(new BasicHep3Vector(0,0,zSlice)),
+                        new Transform3D(new Translation3D(0,0,zSlice)),
                         "slice"+j,
                         lvSlice,
                         lvLayer,

GeomConverter/src/org/lcsim/detector/converter/compact
SiTrackerBarrelConverter.java 1.20 -> 1.21
diff -u -r1.20 -r1.21
--- SiTrackerBarrelConverter.java	3 Jul 2007 23:35:34 -0000	1.20
+++ SiTrackerBarrelConverter.java	7 Aug 2007 18:11:39 -0000	1.21
@@ -2,7 +2,6 @@
 
 import static java.lang.Math.cos;
 import static java.lang.Math.sin;
-import hep.physics.vec.BasicHep3Vector;
 import hep.physics.matrix.BasicMatrix;
 
 import java.util.HashMap;
@@ -17,7 +16,10 @@
 import org.lcsim.detector.IPhysicalVolumePath;
 import org.lcsim.detector.LogicalVolume;
 import org.lcsim.detector.PhysicalVolume;
-import org.lcsim.detector.Rotation3D;
+import org.lcsim.detector.IRotation3D;
+import org.lcsim.detector.RotationPassiveXYZ;
+import org.lcsim.detector.ITranslation3D;
+import org.lcsim.detector.Translation3D;
 import org.lcsim.detector.Transform3D;
 import org.lcsim.detector.identifier.ExpandedIdentifier;
 import org.lcsim.detector.identifier.IIdentifier;
@@ -148,10 +150,7 @@
                 new LogicalVolume(componentName, componentBox, componentMaterial);
                                     
             // Set component position.                 
-            BasicHep3Vector pos = new BasicHep3Vector();
-            Rotation3D rot = new Rotation3D();
-            
-            double px=0, py=0, pz=0, rx=0, ry=0, rz=0;
+            double px=0, py=0, pz=0;
             
             if (componentElement.getChild("position") != null)
             {
@@ -173,9 +172,11 @@
                 }
             }
             
-            pos.setV(px,py,pz);
+            ITranslation3D pos = new Translation3D(px,py,pz);
 
             // Set component rotation.
+            double rx=0, ry=0, rz=0;
+            
             if (componentElement.getChild("rotation") != null)
             {
                 Element rot_elem = componentElement.getChild("rotation");
@@ -196,8 +197,9 @@
                 }
             }
             
-            rot.setPassiveXYZ(rx,ry,rz);
+            IRotation3D rot = new RotationPassiveXYZ(rx,ry,rz);
 
+            // Make transform
             Transform3D componentTransform = new Transform3D(pos,rot);
             
             PhysicalVolume componentPhysVol =
@@ -384,10 +386,7 @@
 
                     // Position of module.
                     //Position module_position = new Position(module_place_name + "_position");
-                    BasicHep3Vector module_position = new BasicHep3Vector(x,y,z); 
-
-                    // Rotation of module.
-                    Rotation3D module_rotation = new Rotation3D();
+                    ITranslation3D module_position = new Translation3D(x,y,z); 
                     
                     /*
                      from the LCDD converter 
@@ -398,14 +397,17 @@
                                         
                     */
                     
+                    // Rotation of module.
+                    
                     // FIXME:  The Y and Z rotations are switched around from
                     //         the LCDD / Geant4 convention.  Seems like an
                     //         active versus passive problem.
                     double rotx = Math.PI/2;
                     double roty = 0;
                     double rotz = ((Math.PI / 2) - phic - phi_tilt);
-                    
-                    module_rotation.setPassiveXYZ(rotx,roty,rotz);
+
+
+                    IRotation3D module_rotation = new RotationPassiveXYZ(rotx,roty,rotz);
 
                     //System.out.println("module rotx=" + rotx);
                     //System.out.println("module roty=" + roty);

GeomConverter/src/org/lcsim/detector/converter/compact
DiskTrackerConverter.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- DiskTrackerConverter.java	12 Jul 2007 06:54:42 -0000	1.10
+++ DiskTrackerConverter.java	7 Aug 2007 18:11:39 -0000	1.11
@@ -1,7 +1,5 @@
 package org.lcsim.detector.converter.compact;
 
-import hep.physics.vec.BasicHep3Vector;
-
 import org.lcsim.geometry.IDDecoder;
 import org.lcsim.detector.DetectorElement;
 import org.lcsim.detector.IDetectorElement;
@@ -9,7 +7,9 @@
 import org.lcsim.detector.ILogicalVolume;
 import org.lcsim.detector.LogicalVolume;
 import org.lcsim.detector.PhysicalVolume;
-import org.lcsim.detector.Rotation3D;
+import org.lcsim.detector.IRotation3D;
+import org.lcsim.detector.RotationPassiveXYZ;
+import org.lcsim.detector.Translation3D;
 import org.lcsim.detector.Transform3D;
 import org.lcsim.detector.material.IMaterial;
 import org.lcsim.detector.material.MaterialStore;
@@ -55,8 +55,7 @@
             endcapNeg.setParent(tracker.getDetectorElement());
         }
 
-        Rotation3D reflect = new Rotation3D();
-        reflect.setPassiveXYZ(0, Math.PI, 0);
+        IRotation3D reflect = new RotationPassiveXYZ(0, Math.PI, 0);
              
         int sensorNum=0;
 
@@ -85,7 +84,7 @@
             // Layer in positive z.
             new PhysicalVolume(
                     new Transform3D(
-                            new BasicHep3Vector(
+                            new Translation3D(
                                     0,
                                     0,
                                     layerInnerZ + layer.getThickness()/2 )),
@@ -99,7 +98,7 @@
             {                                 
                 new PhysicalVolume(
                         new Transform3D(
-                                new BasicHep3Vector(
+                                new Translation3D(
                                         0.,
                                         0.,                                       
                                         -layerInnerZ - layer.getThickness()/2
@@ -137,7 +136,7 @@
 
                 new PhysicalVolume(
                         new Transform3D(
-                                new BasicHep3Vector(
+                                new Translation3D(
                                         0,
                                         0,
                                         sliceZ )),

GeomConverter/test/org/lcsim/detector/solids
TrdTest.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- TrdTest.java	27 Jul 2007 22:38:59 -0000	1.2
+++ TrdTest.java	7 Aug 2007 18:11:39 -0000	1.3
@@ -25,7 +25,11 @@
 import org.lcsim.detector.LogicalVolume;
 import org.lcsim.detector.PhysicalVolume;
 import org.lcsim.detector.PhysicalVolumeNavigatorStore;
-import org.lcsim.detector.Rotation3D;
+import org.lcsim.detector.IRotation3D;
+import org.lcsim.detector.RotationPassiveXYZ;
+import org.lcsim.detector.ITranslation3D;
+import org.lcsim.detector.Translation3D;
+import org.lcsim.detector.ITransform3D;
 import org.lcsim.detector.Transform3D;
 import org.lcsim.detector.converter.heprep.DetectorElementToHepRepConverter;
 import org.lcsim.detector.material.IMaterial;
@@ -35,7 +39,7 @@
  * Test that writes out the HepRep for a {@link org.lcsim.detector.solids.Trd}.
  *
  * @author Jeremy McCormick
- * @version $Id: TrdTest.java,v 1.2 2007/07/27 22:38:59 jeremy Exp $
+ * @version $Id: TrdTest.java,v 1.3 2007/08/07 18:11:39 tknelson Exp $
  */
 
 public class TrdTest 
@@ -86,11 +90,10 @@
 			 
 			double x=r*Math.cos(phi);
 			double y=r*Math.sin(phi);
-			Hep3Vector trans = new BasicHep3Vector(x,y,0);
-			Rotation3D rotate = new Rotation3D();
-			
-			rotate.setPassiveXYZ(Math.PI/2, 0, zc);
-			Transform3D transform = new Transform3D(trans,rotate); 			
+			ITranslation3D trans = new Translation3D(x,y,0);
+			IRotation3D rotate = new RotationPassiveXYZ(Math.PI/2, 0, zc);
+                        
+			ITransform3D transform = new Transform3D(trans,rotate); 			
 						
 			String name="pvtrd_rot_"+i;
 			new PhysicalVolume(

GeomConverter/src/org/lcsim/detector
ITranslation3D.java added at 1.1
diff -N ITranslation3D.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ITranslation3D.java	7 Aug 2007 18:11:39 -0000	1.1
@@ -0,0 +1,33 @@
+/*
+ * ITranslation3D.java
+ *
+ * Created on August 6, 2007, 2:52 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+
+/**
+ *
+ * @author tknelson
+ */
+public interface ITranslation3D extends Hep3Vector
+{
+    
+    public Hep3Vector getTranslationVector();
+    
+    public void setTranslationVector(Hep3Vector translation);
+    
+    public void translate(Hep3Vector coordinates);
+    
+    public Hep3Vector translated(Hep3Vector coordinates);
+    
+    public void invert();
+    
+    public ITranslation3D inverse();
+    
+}

GeomConverter/src/org/lcsim/detector
RotationGeant.java added at 1.1
diff -N RotationGeant.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ RotationGeant.java	7 Aug 2007 18:11:39 -0000	1.1
@@ -0,0 +1,48 @@
+/*
+ * RotationGeant.java
+ *
+ * Created on July 31, 2007, 3:45 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.BasicHep3Vector;
+
+/**
+ *
+ * @author tknelson
+ */
+public class RotationGeant extends Rotation3D
+{
+    
+    /** Creates a new instance of RotationGeant */
+    public RotationGeant(double a, double b, double c)
+    {
+        super(makeRotation(a,b,c));
+    }
+    
+    // Static Method
+    //===============
+    public static IRotation3D makeRotation(double phi, double theta, double psi)
+    {
+        Hep3Vector x_axis = new BasicHep3Vector(1,0,0);
+        Hep3Vector y_axis = new BasicHep3Vector(0,1,0);
+        Hep3Vector z_axis = new BasicHep3Vector(0,0,1);
+        
+        // Rotate around body x_axis
+        IRotation3D rotation = passiveAxisRotation(phi,x_axis);
+               
+        // Rotate around body y_axis
+        rotation.multiplyBy(passiveAxisRotation(theta,rotation.rotated(y_axis)));
+        
+        // Rotate around body z_axis
+        rotation.multiplyBy(passiveAxisRotation(theta,rotation.rotated(z_axis)));
+        
+        return rotation;
+    }
+    
+}

GeomConverter/src/org/lcsim/detector
RotationPassiveXYZ.java added at 1.1
diff -N RotationPassiveXYZ.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ RotationPassiveXYZ.java	7 Aug 2007 18:11:40 -0000	1.1
@@ -0,0 +1,35 @@
+/*
+ * RotationPassiveXYZ.java
+ *
+ * Created on July 31, 2007, 3:45 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Matrix;
+import hep.physics.vec.VecOp;
+
+/**
+ *
+ * @author tknelson
+ */
+public class RotationPassiveXYZ extends Rotation3D
+{
+    
+    /** Creates a new instance of RotationPassiveXYZ */
+    public RotationPassiveXYZ(double alpha, double beta, double gamma)
+    {
+        super(makeRotation(alpha,beta,gamma));
+    }
+   
+    // Static Method
+    //===============
+    public static IRotation3D makeRotation(double alpha, double beta, double gamma)
+    {
+        return multiply(passiveZRotation(gamma),multiply(passiveYRotation(beta),passiveXRotation(alpha)));
+    }
+    
+}

GeomConverter/src/org/lcsim/detector
Translation3D.java added at 1.1
diff -N Translation3D.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Translation3D.java	7 Aug 2007 18:11:40 -0000	1.1
@@ -0,0 +1,68 @@
+/*
+ * Translation3D.java
+ *
+ * Created on August 6, 2007, 2:43 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.VecOp;
+
+/**
+ *
+ * @author tknelson
+ */
+public class Translation3D extends BasicHep3Vector implements ITranslation3D
+{
+    
+    /** Creates a new instance of Translation3D */
+    public Translation3D()
+    {
+    }
+    
+    public Translation3D(Hep3Vector translation)
+    {
+        this.setV(translation.x(),translation.y(),translation.z());
+    }
+    
+    public Translation3D(double x, double y, double z)
+    {
+        this.setV(x,y,z);
+    }
+    
+    public Hep3Vector getTranslationVector()
+    {
+        return (Hep3Vector)this;
+    }
+    
+    public void setTranslationVector(Hep3Vector translation)
+    {
+        this.setV(translation.x(),translation.y(),translation.z());
+    }
+    
+    public void translate(Hep3Vector coordinates)
+    {
+        setTranslationVector(translated(coordinates));
+    }
+    
+    public Hep3Vector translated(Hep3Vector coordinates)
+    {
+        return VecOp.add(coordinates,this);
+    }
+    
+    public void invert()
+    {
+        setTranslationVector(inverse().getTranslationVector());
+    }
+    
+    public ITranslation3D inverse()
+    {
+        return new Translation3D(VecOp.mult(-1.0,this));
+    }
+    
+}

GeomConverter/src/org/lcsim/detector
RotationPassiveEuler.java added at 1.1
diff -N RotationPassiveEuler.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ RotationPassiveEuler.java	7 Aug 2007 18:11:40 -0000	1.1
@@ -0,0 +1,35 @@
+/*
+ * RotationPassiveEuler.java
+ *
+ * Created on July 31, 2007, 3:45 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Matrix;
+import hep.physics.vec.VecOp;
+
+/**
+ *
+ * @author tknelson
+ */
+public class RotationPassiveEuler extends Rotation3D
+{
+    
+    /** Creates a new instance of RotationPassiveEuler */
+    public RotationPassiveEuler(double phi, double theta, double psi)
+    {
+        super(makeRotation(phi,theta,psi));
+    }
+  
+    // Static Method
+    //===============
+    public static IRotation3D makeRotation(double phi, double theta, double psi)
+    {
+        return multiply(passiveZRotation(psi),multiply(passiveXRotation(theta),passiveZRotation(phi)));
+    }
+    
+}

GeomConverter/src/org/lcsim/detector
PhysicalVolume.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- PhysicalVolume.java	7 Apr 2007 21:40:12 -0000	1.8
+++ PhysicalVolume.java	7 Aug 2007 18:11:39 -0000	1.9
@@ -43,7 +43,7 @@
 		PhysicalVolumeStore.getInstance().add(this);
 	}			
 	
-	public Rotation3D getRotation()
+	public IRotation3D getRotation()
 	{
 		return transform.getRotation();
 	}

GeomConverter/src/org/lcsim/detector
IRotation3D.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- IRotation3D.java	9 May 2007 00:59:57 -0000	1.8
+++ IRotation3D.java	7 Aug 2007 18:11:40 -0000	1.9
@@ -1,88 +1,43 @@
 package org.lcsim.detector;
 
-import hep.physics.vec.BasicHep3Matrix;
 import hep.physics.vec.Hep3Matrix;
+import hep.physics.vec.Hep3Vector;
+
+import java.io.PrintStream;
 
 /**
  * An interface to rotations in 3D space,
  * using interfaces and base classes from
- * <a href="http://java.freehep.org/freehep-physics/">freehep physics</a>. 
- * 
+ * <a href="http://java.freehep.org/freehep-physics/">freehep physics</a>.
+ *
  * @author Tim Nelson
  * @author Jeremy McCormick
- * 
- * @version $Id: IRotation3D.java,v 1.8 2007/05/09 00:59:57 jeremy Exp $
+ *
+ * @version $Id: IRotation3D.java,v 1.9 2007/08/07 18:11:40 tknelson Exp $
  */
 public interface IRotation3D
-{   
-	/**
-	 * Numerical constants for the X and Y column indices.
-	 */
-	public static final int XCol=0, YCol=1, ZCol=2,XRow=0,YRow=1,ZRow=2;
-	
-	/**
-	 * The numbered components of the rotation matrix.
-	 */
-	public static final int XX=0, XY=1, XZ=2, YX=3, YY=4, YZ=5, ZX=6, ZY=7, ZZ=8;
-	
-	/**
-	 * Total number of components in the matrix.
-	 */
-	public static final int NComponents=9;
-	
-	/**
-	 * The number of rows and columns in the matrix.
-	 */
-	public static final int NRows=3,NCols=3;
-	
-	/**
-	 * The rotation in standard rotation matrix form.
-	 * @return The BasicHep3Matrix representing this rotation.
-	 */
-	public BasicHep3Matrix getRotationMatrix();   
-
-	/**
-	 * Set the matrix from a Hep3Matrix interface.
-	 * @param matrix
-	 */
-	public void setRotationMatrix(Hep3Matrix matrix);
-	
-	/**
-	 * Set the matrix from a BasicHep3Matrix class.
-	 * @param matrix
-	 */
-	public void setRotationMatrix(BasicHep3Matrix matrix);
-	
-	/**
-	 * Set the matrix components from an array of at least length 9.
-	 * @param components
-	 */
-    public void setRotationMatrix(double[] components); 
-    
-    /**
-     * Set the rotation using successive passive rotations
-     * of X, Y, and Z, which matches the GDML/LCDD/Geant4 conventions.
-     * @param alpha Angle about X axis.
-     * @param beta  Angle about Y axis.
-     * @param gamma Angle about Z axis.
-     */
-    public void setPassiveXYZ(double alpha, double beta, double gamma);
-    
-    /**
-     * Set passive Euler rotation.
-     * @param phi
-     * @param theta
-     * @param psi
-     */
-    public void setPassiveEuler(double phi, double theta, double psi);
-    
-    /**
-     * Set active Euler rotation.
-     * @param phi
-     * @param theta
-     * @param psi
+{
+    /**
+     * Numerical constants for the X and Y column indices.
+     */
+    public static final int XCol=0, YCol=1, ZCol=2,XRow=0,YRow=1,ZRow=2;
+    
+    /**
+     * The number of rows and columns in the matrix.
+     */
+    public static final int NRows=3,NCols=3;
+    
+    /**
+     * The rotation in standard rotation matrix form.
+     * @return The BasicHep3Matrix representing this rotation.
+     */
+    public Hep3Matrix getRotationMatrix();
+    
+    /**
+     * Set the matrix from a Hep3Matrix interface.
+     * @param matrix
      */
-    public void setActiveEuler(double phi, double theta, double psi);
+    public void setRotationMatrix(Hep3Matrix matrix);
     
     /**
      * Multiply this rotation in place with another IRotation3D,
@@ -92,31 +47,27 @@
     public void multiplyBy(IRotation3D rotation);
     
     /**
-     * Compare this IRotation3D with another.     
-     * @param rotation
-     * @return True if all components of the matrices are equal.
+     * Rotate a Hep3Vector in place
+     * @param coordinates
      */
-    public boolean equals(IRotation3D rotation);
+    
+    public void rotate(Hep3Vector coordinates);
     
     /**
-     * Set all 9 components of the matrix.
-     * @param xx
-     * @param xy
-     * @param xz
-     * @param yx
-     * @param yy
-     * @param yz
-     * @param zx
-     * @param zy
-     * @param zz
+     * Rotate a Hep3Vector
+     * @param coordinates
+     * @return rotated Hep3Vector
      */
-    public void setComponents(double xx, double xy, double xz, double yx, double yy, double yz, double zx, double zy, double zz);
+    
+    public Hep3Vector rotated(Hep3Vector coordinates);
     
     /**
-     * Get the components as an array of length 9.
-     * @return Components in array of length 9.
+     * Compare this IRotation3D with another.
+     * @param rotation
+     * @return True if all components of the matrices are equal.
      */
-    public double[] getComponents();
+    
+    public boolean equals(IRotation3D rotation);
     
     /**
      * Apply inverse transformation in place.
@@ -131,12 +82,6 @@
     public IRotation3D inverse();
     
     /**
-     * The trace of the matrix.
-     * @return The trace of the matrix.
-     */
-    public double trace();  
-    
-    /**
      * Get matrix component by row and column.
      * @param row
      * @param col
@@ -145,21 +90,20 @@
     public double getComponent(int row, int col);
     
     /**
-     * Get the ith component. 
-     * Use the symbolic constants XX, XY, etc. 
-     * @param i The ith component to return.
-     * @return The ith component.
-     */
-    public double getComponent(int i);
-
-    /**
      * Reset this IRotation3D to the identity matrix.
      */
     public void resetToIdentity();
     
     /**
      * True if this IRotation3D is equivalent to the identity matrix.
-  	 * @return True if this rotation is equal to identity.
+     * @return True if this rotation is equal to identity.
      */
-    public boolean isIdentity(); 
+    public boolean isIdentity();
+
+    /**
+     * Print out rotation
+     * @param PrintStream for output
+     */
+    public void printOut(PrintStream ps);
+    
 }

GeomConverter/src/org/lcsim/detector
Transform3D.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- Transform3D.java	31 Mar 2007 06:29:32 -0000	1.4
+++ Transform3D.java	7 Aug 2007 18:11:40 -0000	1.5
@@ -21,8 +21,8 @@
 {
     
     // Fields
-    Hep3Vector _translation = new BasicHep3Vector(0.0,0.0,0.0);
-    Rotation3D _rotation = new Rotation3D();
+    ITranslation3D _translation = new Translation3D(); 
+    IRotation3D _rotation = new Rotation3D();
             
     /**
      * Creates a new instance of Transform3D
@@ -31,39 +31,43 @@
     public Transform3D()
     {}
     
-    public Transform3D(Rotation3D rotation)
+    public Transform3D(IRotation3D rotation)
     {
     	this._rotation = rotation;
     }
     
-    public Transform3D(Hep3Vector translation)
+    public Transform3D(ITranslation3D translation)
     {
     	this._translation = translation;
     }
     
-    public Transform3D(Hep3Vector translation, Rotation3D rotation)
+    public Transform3D(ITranslation3D translation, IRotation3D rotation)
     {
         _translation = translation;
         _rotation = rotation;
     }
-    
-    public Transform3D(Hep3Vector translation, IRotation3D rotation)
+
+    // Access to translation and rotation
+    public ITranslation3D getTranslation()
     {
-    	_translation = translation;
-    	_rotation = (Rotation3D)rotation;
+        return _translation;
     }
     
-    // Access to translation and rotation
-    public Hep3Vector getTranslation()
+    private void setTranslation(ITranslation3D translation)
     {
-        return _translation;
+        _translation = translation;
     }
     
-    public Rotation3D getRotation()
+    public IRotation3D getRotation()
     {
         return _rotation;
     }
     
+    private void setRotation(IRotation3D rotation)
+    {
+        _rotation = rotation;
+    }
+    
     // Transformations in place
     public void transform(Hep3Vector coordinates)
     {
@@ -73,14 +77,12 @@
     
     public void translate(Hep3Vector coordinates)
     {
-        Hep3Vector new_coordinates = VecOp.add(coordinates,_translation);
-        ((BasicHep3Vector)coordinates).setV(new_coordinates.x(),new_coordinates.y(),new_coordinates.z());
+        _translation.translate(coordinates);
     }
     
     public void rotate(Hep3Vector coordinates)
     {
-        Hep3Vector new_coordinates = VecOp.mult(_rotation.getRotationMatrix(),coordinates);
-        ((BasicHep3Vector)coordinates).setV(new_coordinates.x(),new_coordinates.y(),new_coordinates.z());
+        _rotation.rotate(coordinates);
     }
      
     // Return transformed vectors
@@ -91,46 +93,43 @@
     
     public Hep3Vector translated(Hep3Vector coordinates)
     {
-        return VecOp.add(coordinates,_translation);
+        return _translation.translated(coordinates);
     }
     
     public Hep3Vector rotated(Hep3Vector coordinates)
     {
-        return VecOp.mult(_rotation.getRotationMatrix(),coordinates);
+        return _rotation.rotated(coordinates);
     }
     
     // Invert the transformation
     public void invert()
     {
-        _translation = VecOp.mult(-1.0,VecOp.mult(_rotation.inverse().getRotationMatrix(),_translation));
-        _rotation.invert();
+        this.setTranslation(inverse().getTranslation());
+        this.setRotation(inverse().getRotation());
     }
     
     public Transform3D inverse()
     {
         Transform3D transform = new Transform3D(
-                VecOp.mult(-1.0,VecOp.mult(_rotation.inverse().getRotationMatrix(),_translation)),
-                _rotation.inverse());
+                ( new Translation3D(_rotation.inverse().rotated(_translation)).inverse()),
+                _rotation.inverse()
+                );
         return transform;
     }
     
-    public static Transform3D multiply(ITransform3D transformation_second, ITransform3D transformation_first)
+    // multiply in place
+    public void multiplyBy(ITransform3D transformation_first)
     {
-        Hep3Vector translation = VecOp.add(
-                VecOp.mult(transformation_second.getRotation().getRotationMatrix(),transformation_first.getTranslation()),
-                transformation_second.getTranslation());
-        Rotation3D rotation = Rotation3D.multiply(transformation_second.getRotation(),transformation_first.getRotation());
-
-        return new Transform3D(translation,rotation);   
+        this.setTranslation(multiply(this,transformation_first).getTranslation());
+        this.setRotation(multiply(this,transformation_first).getRotation());
     }
     
-    // multiply in place
-    public void multiplyBy(ITransform3D transformation_first)
+    public static Transform3D multiply(ITransform3D transformation_second, ITransform3D transformation_first)
     {
-        _translation = VecOp.add(
-                VecOp.mult(this.getRotation().getRotationMatrix(),transformation_first.getTranslation()),
-                this.getTranslation());
-        _rotation.multiplyBy(transformation_first.getRotation());
+        ITranslation3D translation = new Translation3D(transformation_second.translated( transformation_second.rotated(transformation_first.getTranslation()) ) );
+        IRotation3D rotation = Rotation3D.multiply(transformation_second.getRotation(),transformation_first.getRotation());
+
+        return new Transform3D(translation,rotation);   
     }
     
     public String toString()

GeomConverter/src/org/lcsim/detector
Rotation3D.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- Rotation3D.java	2 May 2007 01:58:19 -0000	1.10
+++ Rotation3D.java	7 Aug 2007 18:11:40 -0000	1.11
@@ -4,455 +4,220 @@
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Matrix;
 import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
 
 import java.io.PrintStream;
 
 /**
  * Implementation of the @see IRotation3D interface.
- * 
+ *
  * @author Tim Nelson <[log in to unmask]>
  * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: Rotation3D.java,v 1.10 2007/05/02 01:58:19 jeremy Exp $
+ * @version $Id: Rotation3D.java,v 1.11 2007/08/07 18:11:40 tknelson Exp $
  */
 public class Rotation3D implements IRotation3D
 {
-	/**
-	 * The 3x3 rotation matrix representing the state of this Rotation3D.
-	 */
-	private BasicHep3Matrix matrix = BasicHep3Matrix.identity();
-	
-	/**
-	 * Cache an immutable copy of the identity matrix.
-	 */
-	private static final BasicHep3Matrix identityMatrix = BasicHep3Matrix.identity();
-	
-	/**
-	 * Construct a Rotation3D with the identity matrix.
-	 */
-	public Rotation3D()
-	{}
-	
-	/**
-	 * Construct a Rotation3D from a BasicHep3Matrix.
-	 * @param matrix
-	 */
-	public Rotation3D(BasicHep3Matrix matrix)
-	{
-		setRotationMatrix(matrix);
-	}
-
-	/**
-	 * Construct a Rotation3D from a Hep3Matrix interface.
-	 * @param matrix
-	 */
-	public Rotation3D(Hep3Matrix matrix)
-	{
-		setRotationMatrix((BasicHep3Matrix)matrix);
-	}
-	
-	/**
-	 * Construct a Rotation3D from the individual components.
-	 * @param xx
-	 * @param xy
-	 * @param xz
-	 * @param yx
-	 * @param yy
-	 * @param yz
-	 * @param zx
-	 * @param zy
-	 * @param zz
-	 */
-	public Rotation3D(double xx, double xy, double xz, double yx, double yy, double yz, double zx, double zy, double zz)	
-	{	
-		setComponents(xx,xy,xz,yx,yy,yz,zx,zy,zz);
-	}
-
-	/**
-	 * Set the rotation matrix from a Hep3Matrix.
-	 */
-	public void setRotationMatrix(Hep3Matrix matrix)
-	{
-		this.matrix = (BasicHep3Matrix)matrix;
-	}
-	
-	public void setRotationMatrix(double[] components)
-	{
-		if (components.length < 9)
-		{
-			throw new IllegalArgumentException("Cannot construct matrix from less than 9 components.");
-		}
-	}
-
-	public void setPassiveXYZ(double alpha, double beta, double gamma)
-	{
-		matrix = passiveXYZ(alpha,beta,gamma);
-	}
-
-	public void setPassiveEuler(double phi, double theta, double psi)
-	{
-		matrix.setPassiveEuler(phi,theta,psi); 
-	}
-
-	public void setActiveEuler(double phi, double theta, double psi)
-	{
-		matrix.setActiveEuler(phi,theta,psi);
-	}
-
-	public void invert()
-	{
-		matrix.transpose();
-	}
-
-	public IRotation3D inverse()
-	{
-		BasicHep3Matrix inversematrix = new BasicHep3Matrix(matrix);
-		inversematrix.transpose();
-		return new Rotation3D(inversematrix);
-	}
-
-	public double xx()
-	{
-		return matrix.e(XRow,XCol);
-	}
-
-	public double xy()
-	{
-		return matrix.e(XRow,YCol);
-	}
-
-	public double xz()
-	{
-		return matrix.e(XRow,ZCol);
-	}
-
-	public double yx()
-	{
-		return matrix.e(YRow,XCol);
-	}
-
-	public double yy()
-	{
-		return matrix.e(YRow,YCol);
-	}
-
-	public double yz()
-	{
-		return matrix.e(YRow,ZCol);
-	}
-
-	public double zx()
-	{
-		return matrix.e(ZRow,XCol);
-	}
-
-	public double zy()
-	{
-		return matrix.e(ZRow,YCol);
-	}
-
-	public double zz()
-	{
-		return matrix.e(ZRow,ZCol);
-	}
-
-	public void printOut(PrintStream ps)
-	{
-		ps.print("[");
-		ps.println();
-
-		BasicHep3Matrix m = getRotationMatrix();
-
-		for (int i=0; i<3; i++)
-		{
-			ps.printf("%.5f %.5f %.5f", m.e(i,0), m.e(i,1), m.e(i,2));
-			ps.println();
-		}    	    	    	    	    
-
-		ps.print("]");
-		ps.println('\n');
-	}
-	
-	public String toString()
-	{
-		StringBuffer buff = new StringBuffer();
-		buff.append("[");
-		buff.append('\n');
-		buff.append(xx() + " " + xy() + " " + xz() + '\n');
-		buff.append(yx() + " " + yy() + " " + yz() + '\n');
-		buff.append(zx() + " " + zy() + " " + zz() + '\n');
-		buff.append('\n');
-		buff.append("]");
-		return buff.toString();
-	}
-
-	// This setColumn is where the error handling should go.
-	public void setColumn(int col, double[] arr)
-	{
-		if (col < 0 || col > 2)
-		{
-			throw new IllegalArgumentException("col must be between 0 and 2 inclusive.");
-		}
-		if (arr.length<3)
-		{
-			throw new IllegalArgumentException("not enough values in array to fill column.");
-		}
-		for (int i=0; i<3; i++)
-		{
-			setComponent(i,col,arr[i]);
-		}
-	}
-
-	public void setColumn(int col, Hep3Vector vec)
-	{
-		setColumn(col,vec.v());
-	}
-
-	public void setRow(int row, double[] arr)
-	{
-		if (row < 0 || row > 2)
-		{
-			throw new IllegalArgumentException("row must be between 0 and 2 inclusive.");
-		}
-		if (arr.length<3)
-		{
-			throw new IllegalArgumentException("not enough values in array to fill row.");
-		}
-		for (int i=0; i<3; i++)
-		{
-			setComponent(row, i, arr[i]);
-		}
-	}    
-
-	public void setRow(int row, Hep3Vector vec)
-	{
-		setRow(row,vec.v());
-	}
-
-	public void setComponent(int row, int col, double v)
-	{
-		matrix.setElement(row,col,v);
-	}
-
-	public void setColumn(int col, double x, double y, double z) 
-	{
-		setColumn(col, new double[]{x,y,z});
-	}
-
-	public void setRow(int row, double a, double b, double c) 
-	{
-		setRow(row,new double[]{a,b,c});
-	}
-
-	public void setComponents(double xx, double xy, double xz, double yx, double yy, double yz, double zx, double zy, double zz) 
-	{
-		setRowX(xx,xy,xz);
-		setRowY(yx,yy,yz);
-		setRowZ(zx,zy,zz);
-	}		
-
-	public double[] getComponents()
-	{
-		double[] arr = new double[9];
-		int c=0;
-		for (int i=0; i<3; i++)
-		{
-			for (int j=0; j<3; j++)
-			{
-				arr[c]=matrix.e(i,j);
-				c++;
-			}
-		}
-		return arr;
-	}
-
-	public void setRowX(double xx, double xy, double xz)
-	{		
-		setComponent(XRow,XCol,xx);
-		setComponent(XRow,YCol,xy);
-		setComponent(XRow,ZCol,xz);
-	}
-
-	public void setRowY(double yx, double yy, double yz)
-	{
-		setComponent(YRow,XCol,yx);
-		setComponent(YRow,YCol,yy);
-		setComponent(YRow,ZCol,yz);
-	}
-
-	public void setRowZ(double zx, double zy, double zz)
-	{
-		setComponent(ZRow,XCol,zx);
-		setComponent(ZRow,YCol,zy);
-		setComponent(ZRow,ZCol,zz);
-	}
-
-	public void resetToIdentity()
-	{
-		matrix = BasicHep3Matrix.identity();
-	}
-
-	public double trace()
-	{
-		return matrix.trace();
-	}
-
-	public BasicHep3Matrix getRotationMatrix()
-	{
-		return this.matrix;
-	}
-
-	public void setRotationMatrix(BasicHep3Matrix matrix)
-	{
-		this.matrix = matrix;
-	} 
-
-	public double getComponent(int row, int col)
-	{
-		return matrix.e(row,col);
-	}
-
-	public double getComponent(int i)
-	{
-		switch (i)
-		{
-		case XX:
-			return xx();
-		case XY:
-			return xy();
-		case XZ:
-			return xz();
-		case YX:
-			return yx();
-		case YY:
-			return yy();
-		case YZ:
-			return yz();
-		case ZX:
-			return zx();
-		case ZY:
-			return zy();
-		case ZZ:
-			return zz();
-		default:
-			throw new IllegalArgumentException("Invalid matrix element : " + i );					
-		}
-	}
-	
-	public void multiplyBy(IRotation3D rotation)
-	{
-		this.setRotationMatrix(Rotation3D.mult(this.getRotationMatrix(), rotation.getRotationMatrix()));
-	}
-	
-	public static Rotation3D multiply(IRotation3D rot1, IRotation3D rot2)
-	{
-		return new Rotation3D(Rotation3D.mult(rot1.getRotationMatrix(), rot2.getRotationMatrix()));		
-	}
-
-	/**
-	 * Rewrite of hep.physics.vec.VecOp.mult by Tim Nelson.
-	 * 
-	 * TODO: Calls to this method should be replaced with the
-	 *       freehep method @see hep.physics.vec.VecOp#mult, 
-	 *       once this has been fixed!
-	 * 
-	 * @param m1 The left matrix.
-	 * @param m2 The right matrix.
-	 * @return The product of the two matrices.
-	 */
-	private static Hep3Matrix mult(Hep3Matrix m1, Hep3Matrix m2)
-	{
-		double e0 = m1.e(0,0) * m2.e(0,0) + m1.e(0,1) * m2.e(1,0) + m1.e(0,2) * m2.e(2,0);
-		double e1 = m1.e(0,0) * m2.e(0,1) + m1.e(0,1) * m2.e(1,1) + m1.e(0,2) * m2.e(2,1);
-		double e2 = m1.e(0,0) * m2.e(0,2) + m1.e(0,1) * m2.e(1,2) + m1.e(0,2) * m2.e(2,2);
-
-		double e3 = m1.e(1,0) * m2.e(0,0) + m1.e(1,1) * m2.e(1,0) + m1.e(1,2) * m2.e(2,0);
-		double e4 = m1.e(1,0) * m2.e(0,1) + m1.e(1,1) * m2.e(1,1) + m1.e(1,2) * m2.e(2,1);
-		double e5 = m1.e(1,0) * m2.e(0,2) + m1.e(1,1) * m2.e(1,2) + m1.e(1,2) * m2.e(2,2);
-
-		double e6 = m1.e(2,0) * m2.e(0,0) + m1.e(2,1) * m2.e(1,0) + m1.e(2,2) * m2.e(2,0);
-		double e7 = m1.e(2,0) * m2.e(0,1) + m1.e(2,1) * m2.e(1,1) + m1.e(2,2) * m2.e(2,1);
-		double e8 = m1.e(2,0) * m2.e(0,2) + m1.e(2,1) * m2.e(1,2) + m1.e(2,2) * m2.e(2,2);
-
-		return new BasicHep3Matrix(e0,e1,e2,e3,e4,e5,e6,e7,e8);
-	}
-	
-	public boolean equals(IRotation3D rotation)
-	{
-		boolean result=true;
-		for (int row=XRow; row<3; row++)
-		{
-			for (int col=YCol; col<3; col++)
-			{
-				if (this.getComponent(row,col) != rotation.getComponent(row,col))
-				{
-					result=false;
-					break;
-				}				
-			}			
-		}
-		return result;
-	}
-	
-	public boolean isIdentity()
-	{
-		return equals(identityMatrix);
-	}
-	
-	// Static Method
-	//===============
-	public static BasicHep3Matrix passiveEuler(double phi, double theta, double psi)
-	{
-		BasicHep3Matrix matrix = new BasicHep3Matrix();
-		matrix.setPassiveEuler(phi,theta,psi);
-		return matrix;
-	}
-
-	// Static Method
-	//===============
-	public static BasicHep3Matrix passiveXYZ(double alpha, double beta, double gamma)
-	{
-		return (BasicHep3Matrix)mult(passiveZRotation(gamma),mult(passiveYRotation(beta),passiveXRotation(alpha)));
-	}
-
-	// Static Method
-	//===============
-	public static BasicHep3Matrix passiveXRotation(double angle)
-	{
-		double sin = Math.sin(angle);
-		double cos = Math.cos(angle);
-		BasicHep3Matrix rotation = BasicHep3Matrix.identity();
-		rotation.setElement(1,1,cos);
-		rotation.setElement(1,2,sin);
-		rotation.setElement(2,1,-sin);
-		rotation.setElement(2,2,cos);
-		return rotation;
-	}
-
-	// Static Method
-	//===============
-	public static BasicHep3Matrix passiveYRotation(double angle)
-	{
-		double sin = Math.sin(angle);
-		double cos = Math.cos(angle);
-		BasicHep3Matrix rotation = BasicHep3Matrix.identity();
-		rotation.setElement(0,0,cos);
-		rotation.setElement(0,2,-sin);
-		rotation.setElement(2,0,sin);        
-		rotation.setElement(2,2,cos);
-		return rotation;
-	}
-
-	// Static Method
-	//===============
-	public static BasicHep3Matrix passiveZRotation(double angle)
-	{
-		double sin = Math.sin(angle);
-		double cos = Math.cos(angle);
-		BasicHep3Matrix rotation = BasicHep3Matrix.identity();
-		rotation.setElement(0,0,cos);
-		rotation.setElement(0,1,sin);
-		rotation.setElement(1,0,-sin);
-		rotation.setElement(1,1,cos);
-		return rotation;
-	}    
+    /**
+     * The 3x3 rotation _matrix representing the state of this Rotation3D.
+     */
+    protected Hep3Matrix _matrix = BasicHep3Matrix.identity();
+   
+    /**
+     * Construct a Rotation3D with the identity _matrix.
+     */
+    public Rotation3D()
+    {}
+    
+    /**
+     * Construct a Rotation3D from a Hep3Matrix interface.
+     *
+     * @param _matrix
+     */
+    public Rotation3D(Hep3Matrix matrix)
+    {
+        setRotationMatrix(matrix);
+    }
+    
+    /**
+     * Construct a copy from a Rotation3D.
+     *
+     * @param _matrix
+     */
+    public Rotation3D(IRotation3D rotation)
+    {
+        setRotationMatrix(rotation.getRotationMatrix());
+    }
+    
+    /**
+     * Set the rotation _matrix from a Hep3Matrix.
+     */
+    public void setRotationMatrix(Hep3Matrix matrix)
+    {
+        this._matrix = (BasicHep3Matrix)matrix;
+    }
+    
+    public void invert()
+    {
+        ((BasicHep3Matrix)_matrix).transpose();
+    }
+    
+    public IRotation3D inverse()
+    {
+        BasicHep3Matrix inversematrix = new BasicHep3Matrix(_matrix);
+        inversematrix.transpose();
+        return new Rotation3D(inversematrix);
+    }
+    
+    public void printOut(PrintStream ps)
+    {
+        ps.print("[");
+        ps.println();
+        
+        BasicHep3Matrix m = (BasicHep3Matrix)getRotationMatrix();
+        
+        for (int i=0; i<3; i++)
+        {
+            ps.printf("%.5f %.5f %.5f", m.e(i,0), m.e(i,1), m.e(i,2));
+            ps.println();
+        }
+        
+        ps.print("]");
+        ps.println('\n');
+    }
+    
+    public String toString()
+    {
+        StringBuffer buff = new StringBuffer();
+        buff.append("[");
+        buff.append('\n');
+        buff.append(_matrix.e(0,0) + " " + _matrix.e(0,1) + " " + _matrix.e(0,2) + '\n');
+        buff.append(_matrix.e(1,0) + " " + _matrix.e(1,1) + " " + _matrix.e(1,2) + '\n');
+        buff.append(_matrix.e(2,0) + " " + _matrix.e(2,1) + " " + _matrix.e(2,2) + '\n');
+        buff.append('\n');
+        buff.append("]");
+        return buff.toString();
+    }
+    
+    public void resetToIdentity()
+    {
+        _matrix = BasicHep3Matrix.identity();
+    }
+    
+    public Hep3Matrix getRotationMatrix()
+    {
+        return this._matrix;
+    }
+    
+    public double getComponent(int row, int col)
+    {
+        return _matrix.e(row,col);
+    }
+    
+    public void multiplyBy(IRotation3D rotation)
+    {
+        this.setRotationMatrix(VecOp.mult(this.getRotationMatrix(), rotation.getRotationMatrix()));
+    }
+    
+    public void rotate(Hep3Vector coordinates)
+    {
+        Hep3Vector new_coordinates = VecOp.mult(_matrix,coordinates);
+        ((BasicHep3Vector)coordinates).setV(new_coordinates.x(),new_coordinates.y(),new_coordinates.z());
+    }
+    
+    public Hep3Vector rotated(Hep3Vector coordinates)
+    {
+        return VecOp.mult(_matrix,coordinates);
+    }
+    
+    public static Rotation3D multiply(IRotation3D rot1, IRotation3D rot2)
+    {
+        return new Rotation3D(VecOp.mult(rot1.getRotationMatrix(), rot2.getRotationMatrix()));
+    }
+    
+    public boolean equals(IRotation3D rotation)
+    {
+        boolean result=true;
+        for (int row=XRow; row<3; row++)
+        {
+            for (int col=YCol; col<3; col++)
+            {
+                if (this.getComponent(row,col) != rotation.getComponent(row,col))
+                {
+                    result=false;
+                    break;
+                }
+            }
+        }
+        return result;
+    }
+    
+    public boolean isIdentity()
+    {
+        return equals(BasicHep3Matrix.identity());
+    }
+
+    // Static Methods
+    //===============
+    public static IRotation3D passiveXRotation(double angle)
+    {
+        double sin = Math.sin(angle);
+        double cos = Math.cos(angle);
+        BasicHep3Matrix rotation_matrix = BasicHep3Matrix.identity();
+        rotation_matrix.setElement(1,1,cos);
+        rotation_matrix.setElement(1,2,sin);
+        rotation_matrix.setElement(2,1,-sin);
+        rotation_matrix.setElement(2,2,cos);
+        return new Rotation3D(rotation_matrix);
+    }
+    
+    public static IRotation3D passiveYRotation(double angle)
+    {
+        double sin = Math.sin(angle);
+        double cos = Math.cos(angle);
+        BasicHep3Matrix rotation_matrix = BasicHep3Matrix.identity();
+        rotation_matrix.setElement(0,0,cos);
+        rotation_matrix.setElement(0,2,-sin);
+        rotation_matrix.setElement(2,0,sin);
+        rotation_matrix.setElement(2,2,cos);
+        return new Rotation3D(rotation_matrix);
+    }
+    
+    public static IRotation3D passiveZRotation(double angle)
+    {
+        double sin = Math.sin(angle);
+        double cos = Math.cos(angle);
+        BasicHep3Matrix rotation_matrix = BasicHep3Matrix.identity();
+        rotation_matrix.setElement(0,0,cos);
+        rotation_matrix.setElement(0,1,sin);
+        rotation_matrix.setElement(1,0,-sin);
+        rotation_matrix.setElement(1,1,cos);
+        return new Rotation3D(rotation_matrix);
+    }
+    
+    public static IRotation3D passiveAxisRotation(double angle, Hep3Vector axis)
+    {
+        if (axis.magnitude() == 0.0)
+        {
+            // FIXME: throw exception
+        }
+        
+        Hep3Vector unit_axis = VecOp.unit(axis);
+        double dx = unit_axis.x();
+        double dy = unit_axis.y();
+        double dz = unit_axis.z();
+
+        double sa = Math.sin(angle);
+        double ca = Math.cos(angle);
+
+        BasicHep3Matrix rotation_matrix = new BasicHep3Matrix
+                (
+                ca+(1-ca)*dx*dx,        (1-ca)*dx*dy-sa*dz,     (1-ca)*dx*dz+sa*dy,
+                (1-ca)*dy*dx+sa*dz,     ca+(1-ca)*dy*dy,        (1-ca)*dy*dz-sa*dx,
+                (1-ca)*dz*dx-sa*dy,     (1-ca)*dz*dy+sa*dx,     ca+(1-ca)*dz*dz 
+                );
+
+        return new Rotation3D(rotation_matrix);
+        
+    }
+    
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/detector
ITransform3D.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- ITransform3D.java	9 Mar 2007 22:47:38 -0000	1.1
+++ ITransform3D.java	7 Aug 2007 18:11:40 -0000	1.2
@@ -12,21 +12,79 @@
  */
 public interface ITransform3D
 {       
-    public Hep3Vector getTranslation();
-    public Rotation3D getRotation();
+    
+    /**
+     * Get Hep3Vector corresponding to translation
+     * @return translation Hep3Vector
+     */
+    public ITranslation3D getTranslation();
+    
+    /**
+     * Get IRotation3D corresponding to rotation
+     * @return rotation IRotation3D
+     */
+    public IRotation3D getRotation();
     
     // Transformations in place
+    //=========================
+    
+    /**
+     * Transform coordinates in place
+     * @param coordinates to transform
+     */
     public void transform(Hep3Vector coordinates);
-    public void translate(Hep3Vector coordinates);    
-    public void rotate(Hep3Vector coordinates);    
+    
+    /**
+     * Translate coordinates in place
+     * @param coordinates to translate
+     */
+    public void translate(Hep3Vector coordinates);
+    
+    /**
+     * Rotate coordinates in place
+     * @param coordinates to rotate
+     */
+    public void rotate(Hep3Vector coordinates);
     
     // Transformations creating new position vectors
+    //==============================================
+    
+    /**
+     * Transform coordinates
+     * @param coordinates to transform
+     * @return transformed coordinates
+     */
     public Hep3Vector transformed(Hep3Vector coordinates);
-    public Hep3Vector translated(Hep3Vector coordinates);    
-    public Hep3Vector rotated(Hep3Vector coordinates);    
+        
+    /**
+     * Translated coordinates
+     * @param coordinates to translate
+     * @return translated coordinates
+     */
+    public Hep3Vector translated(Hep3Vector coordinates);
+        
+    /**
+     * Rotate coordinates
+     * @param coordinates to rotate
+     * @return rotated coordinates
+     */
+    public Hep3Vector rotated(Hep3Vector coordinates);
     
+    /**
+     * Multply this by another transformation in place
+     * @param transformation to multiply by
+     */
     public void multiplyBy(ITransform3D trans);
     
+    /**
+     * Invert this transformation in place
+     */
     public void invert();
+    
+    /**
+     * Get inverse of this transformation
+     * @ return inverted transformation
+     *
+     */
     public Transform3D inverse();
 }
\ No newline at end of file

lcsim/src/org/lcsim/contrib/SiStripSim
CDFSiSensorSim.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- CDFSiSensorSim.java	10 Jul 2007 23:43:19 -0000	1.4
+++ CDFSiSensorSim.java	7 Aug 2007 18:11:40 -0000	1.5
@@ -13,7 +13,8 @@
 import org.lcsim.detector.tracker.silicon.ErrorEllipse2D;
 import org.lcsim.event.SimTrackerHit;
 
-import org.lcsim.detector.Rotation3D;
+import org.lcsim.detector.IRotation3D;
+import org.lcsim.detector.RotationPassiveXYZ;
 import org.lcsim.detector.tracker.silicon.SiSensor;
 import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
 import org.lcsim.detector.tracker.silicon.SiStrips;
@@ -161,8 +162,7 @@
                     if (_sensor.hasElectrodesOnSide(carrier))
                     {
                         
-                        Rotation3D sensor_to_electrodes = new Rotation3D();
-                        sensor_to_electrodes.setPassiveXYZ(0.0,0.0,-_sensor.getElectrodeAngle(carrier));
+                        IRotation3D sensor_to_electrodes = new RotationPassiveXYZ(0.0,0.0,-_sensor.getElectrodeAngle(carrier));
                         
                         Hep3Vector electrode_drift_destination = VecOp.mult(sensor_to_electrodes.getRotationMatrix(),driftDestination(segment_center,carrier));
                         ErrorEllipse2D electrode_charge_distribution = diffusionEllipse(segment_center,carrier).rotate(-_sensor.getElectrodeAngle(carrier));

GeomConverter/src/org/lcsim/detector/tracker/silicon
SiSensor.java 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- SiSensor.java	10 Jul 2007 23:42:42 -0000	1.11
+++ SiSensor.java	7 Aug 2007 18:11:40 -0000	1.12
@@ -215,8 +215,7 @@
         Hep3Vector global_position = getGeometry().getLocalToGlobal().transformed(local_position);
         Hep3Vector field_global = ((DeDetector)ancestor).getBField(global_position);
         
-        // FIXME - This is silly!!!!!
-        return VecOp.mult(getGeometry().getGlobalToLocal().getRotation().getRotationMatrix(),field_global);
+        return getGeometry().getGlobalToLocal().rotated(field_global);
         
     }
         
CVSspam 0.2.8