Commit in GeomConverter on MAIN
src/org/lcsim/detector/Transform3D.java+165added 1.1
                      /DetectorFactory.java+1-11.1 -> 1.2
                      /ICoordinateTransformation3D.java+1-11.3 -> 1.4
                      /IPhysicalVolumeNavigator.java+3-31.6 -> 1.7
                      /PhysicalVolume.java+1-11.4 -> 1.5
                      /PhysicalVolumeNavigator.java+6-61.8 -> 1.9
                      /CoordinateTransformation3D.java-1651.5 removed
test/org/lcsim/detector/CoordinateTransformation3DTest.java+12-121.6 -> 1.7
+189-189
1 added + 1 removed + 6 modified, total 8 files
JM: Change CoordinateTransformation3D to Transform3D.

GeomConverter/src/org/lcsim/detector
Transform3D.java added at 1.1
diff -N Transform3D.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Transform3D.java	9 Mar 2007 22:23:55 -0000	1.1
@@ -0,0 +1,165 @@
+/*
+ * CoordinateTransformation3D.java
+ */
+
+package org.lcsim.detector;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
+
+/**
+ * A class for representing a 3D coordinate transformation
+ * using a @see Rotation3D for the rotation and a
+ * @see hep.physics.vec.Hep3Vector for the translation.
+ *
+ * @author Tim Nelson <[log in to unmask]>
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class Transform3D 
+implements ICoordinateTransformation3D
+{
+    
+    // Fields
+    Hep3Vector _translation = new BasicHep3Vector(0.0,0.0,0.0);
+    Rotation3D _rotation = new Rotation3D();
+            
+    /**
+     * Creates a new instance of CoordinateTransformation3D
+     * with the identity matrix.
+     */
+    public Transform3D()
+    {}
+    
+    public Transform3D(Rotation3D rotation)
+    {
+    	this._rotation = rotation;
+    }
+    
+    public Transform3D(Hep3Vector translation)
+    {
+    	this._translation = translation;
+    }
+    
+    public Transform3D(Hep3Vector translation, Rotation3D rotation)
+    {
+        _translation = translation;
+        _rotation = rotation;
+    }
+    
+    public Transform3D(Hep3Vector translation, IRotation3D rotation)
+    {
+    	_translation = translation;
+    	_rotation = (Rotation3D)rotation;
+    }
+    
+    // Access to translation and rotation
+    public Hep3Vector getTranslation()
+    {
+        return _translation;
+    }
+    
+    public Rotation3D getRotation()
+    {
+        return _rotation;
+    }
+    
+    // Transformations in place
+    public void transform(Hep3Vector coordinates)
+    {
+//        System.out.println("Input coordinates: "+coordinates);
+//        System.out.println("Translation: "+_translation);
+        translate(coordinates);
+//        System.out.println("Translated coordinates: "+coordinates);
+        
+//        System.out.println("Rotation: "+_rotation);
+        rotate(coordinates);
+//        System.out.println("Rotated coordinates: "+coordinates);
+        
+//        return coordinates;
+    }
+    
+    public void translate(Hep3Vector coordinates)
+    {
+        Hep3Vector new_coordinates = VecOp.add(coordinates,_translation);
+        ((BasicHep3Vector)coordinates).setV(new_coordinates.x(),new_coordinates.y(),new_coordinates.z());
+    }
+    
+    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());
+    }
+     
+    // Return transformed vectors
+    public Hep3Vector transformed(Hep3Vector coordinates)
+    {    
+        return rotated(translated(coordinates));
+    }
+    
+    public Hep3Vector translated(Hep3Vector coordinates)
+    {
+        return VecOp.add(coordinates,_translation);
+    }
+    
+    public Hep3Vector rotated(Hep3Vector coordinates)
+    {
+        return VecOp.mult(_rotation.getRotationMatrix(),coordinates);
+    }
+    
+    // Invert the transformation
+    public void invert()
+    {
+        _translation = VecOp.mult(-1.0,VecOp.mult(_rotation.getRotationMatrix(),_translation));
+        _rotation.invert();
+    }
+    
+    public Transform3D inverse()
+    {
+        Transform3D transform = new Transform3D(
+                VecOp.mult(-1.0,VecOp.mult(_rotation.getRotationMatrix(),_translation)),
+                _rotation.inverse());
+        return transform;
+    }
+    
+    // Static functions
+    public static Transform3D multiply(ICoordinateTransformation3D transformation1, ICoordinateTransformation3D transformation2)
+    {
+        Rotation3D rotation = Rotation3D.multiply(transformation1.getRotation(),transformation2.getRotation());
+        Hep3Vector translation = VecOp.add(
+                VecOp.mult(transformation2.getRotation().inverse().getRotationMatrix(),transformation1.getTranslation()),
+                transformation2.getTranslation());
+        return new Transform3D(translation,rotation);
+    }
+    
+    // multiply in place
+    public void multiplyBy(ICoordinateTransformation3D transformation)
+    {
+        _rotation.multiplyBy(transformation.getRotation());
+        _translation = VecOp.add(
+                VecOp.mult(transformation.getRotation().inverse().getRotationMatrix(),_translation),
+                transformation.getTranslation());
+    }
+    
+    public String toString()
+    {
+    	return _translation.toString() + '\n' + _rotation.toString();
+    }
+    
+    public static Transform3D copy(ICoordinateTransformation3D ci)
+    {
+    	Transform3D c = (Transform3D)ci; 
+    	try { return (Transform3D)c.clone(); } catch (Throwable x) {}
+    	return null;
+    }
+    
+    public static Transform3D copy(Transform3D c)
+    {
+    	try {
+    		return (Transform3D)c.clone();
+    	}
+    	catch (Exception x)
+    	{}
+    	return null;
+    }
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector
DetectorFactory.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- DetectorFactory.java	7 Mar 2007 00:43:41 -0000	1.1
+++ DetectorFactory.java	9 Mar 2007 22:23:55 -0000	1.2
@@ -24,7 +24,7 @@
 
 	public ICoordinateTransformation3D createCoordinateTransformation3D() 
 	{
-		return new CoordinateTransformation3D();
+		return new Transform3D();
 	}
 
 	public IDetectorElement createDetectorElement(

GeomConverter/src/org/lcsim/detector
ICoordinateTransformation3D.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ICoordinateTransformation3D.java	3 Mar 2007 13:33:56 -0000	1.3
+++ ICoordinateTransformation3D.java	9 Mar 2007 22:23:55 -0000	1.4
@@ -28,5 +28,5 @@
     public void multiplyBy(ICoordinateTransformation3D trans);
     
     public void invert();
-    public CoordinateTransformation3D inverse();
+    public Transform3D inverse();
 }
\ No newline at end of file

GeomConverter/src/org/lcsim/detector
IPhysicalVolumeNavigator.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- IPhysicalVolumeNavigator.java	7 Mar 2007 01:13:17 -0000	1.6
+++ IPhysicalVolumeNavigator.java	9 Mar 2007 22:23:55 -0000	1.7
@@ -11,7 +11,7 @@
  * transform of an IPhysicalVolumePath.
  * 
  * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: IPhysicalVolumeNavigator.java,v 1.6 2007/03/07 01:13:17 jeremy Exp $
+ * @version $Id: IPhysicalVolumeNavigator.java,v 1.7 2007/03/09 22:23:55 jeremy Exp $
  */
 public interface IPhysicalVolumeNavigator 
 {
@@ -51,7 +51,7 @@
 	 * @param path
 	 * @return
 	 */
-	public CoordinateTransformation3D getTransform(String path);
+	public Transform3D getTransform(String path);
 	
 	/**
 	 * Get the full transformation from the origin of
@@ -60,7 +60,7 @@
 	 * @param path
 	 * @return
 	 */
-	CoordinateTransformation3D getTransform(IPhysicalVolumePath path);
+	Transform3D getTransform(IPhysicalVolumePath path);
 
 	/**
 	 * Given a global point, return the full path to

GeomConverter/src/org/lcsim/detector
PhysicalVolume.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- PhysicalVolume.java	7 Mar 2007 00:43:41 -0000	1.4
+++ PhysicalVolume.java	9 Mar 2007 22:23:55 -0000	1.5
@@ -25,7 +25,7 @@
 			this.transform = transform;
 		}
 		else {
-			this.transform = new CoordinateTransformation3D();
+			this.transform = new Transform3D();
 		}
 		
 		this.logicalVolume = logicalVolume;

GeomConverter/src/org/lcsim/detector
PhysicalVolumeNavigator.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- PhysicalVolumeNavigator.java	7 Mar 2007 01:13:17 -0000	1.8
+++ PhysicalVolumeNavigator.java	9 Mar 2007 22:23:55 -0000	1.9
@@ -80,10 +80,10 @@
 				// transform up to this point to get the
 				// combined transform.
 				// !!! Is this correct??? !!!
-				CoordinateTransformation3D combinedTransform
-					= CoordinateTransformation3D.multiply(
+				Transform3D combinedTransform
+					= Transform3D.multiply(
 							getTransform(path),
-							(CoordinateTransformation3D)
+							(Transform3D)
 							dau.getTransform());
 
 				//System.out.println("transformed globalPoint : " + combinedTransform.transformed(globalPoint));
@@ -136,7 +136,7 @@
 	 * Get the combined transform from a String path.
 	 * @param path A valid path into the geometry tree.
 	 */
-	public CoordinateTransformation3D getTransform(String path) 
+	public Transform3D getTransform(String path) 
 	{
 		return getTransform(getPath(path));
 	}
@@ -146,9 +146,9 @@
 	 * 
 	 * @param path The PhysicalVolumePath containing the unique geometry node.
 	 */
-	public CoordinateTransformation3D getTransform(IPhysicalVolumePath path) 
+	public Transform3D getTransform(IPhysicalVolumePath path) 
 	{
-		CoordinateTransformation3D theTransform = new CoordinateTransformation3D();
+		Transform3D theTransform = new Transform3D();
 		for (IPhysicalVolume physvol : path)
 		{
 			theTransform.multiplyBy(physvol.getTransform());

GeomConverter/src/org/lcsim/detector
CoordinateTransformation3D.java removed after 1.5
diff -N CoordinateTransformation3D.java
--- CoordinateTransformation3D.java	3 Mar 2007 13:33:56 -0000	1.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,165 +0,0 @@
-/*
- * CoordinateTransformation3D.java
- */
-
-package org.lcsim.detector;
-
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-/**
- * A class for representing a 3D coordinate transformation
- * using a @see Rotation3D for the rotation and a
- * @see hep.physics.vec.Hep3Vector for the translation.
- *
- * @author Tim Nelson <[log in to unmask]>
- * @author Jeremy McCormick <[log in to unmask]>
- */
-public class CoordinateTransformation3D 
-implements ICoordinateTransformation3D
-{
-    
-    // Fields
-    Hep3Vector _translation = new BasicHep3Vector(0.0,0.0,0.0);
-    Rotation3D _rotation = new Rotation3D();
-            
-    /**
-     * Creates a new instance of CoordinateTransformation3D
-     * with the identity matrix.
-     */
-    public CoordinateTransformation3D()
-    {}
-    
-    public CoordinateTransformation3D(Rotation3D rotation)
-    {
-    	this._rotation = rotation;
-    }
-    
-    public CoordinateTransformation3D(Hep3Vector translation)
-    {
-    	this._translation = translation;
-    }
-    
-    public CoordinateTransformation3D(Hep3Vector translation, Rotation3D rotation)
-    {
-        _translation = translation;
-        _rotation = rotation;
-    }
-    
-    public CoordinateTransformation3D(Hep3Vector translation, IRotation3D rotation)
-    {
-    	_translation = translation;
-    	_rotation = (Rotation3D)rotation;
-    }
-    
-    // Access to translation and rotation
-    public Hep3Vector getTranslation()
-    {
-        return _translation;
-    }
-    
-    public Rotation3D getRotation()
-    {
-        return _rotation;
-    }
-    
-    // Transformations in place
-    public void transform(Hep3Vector coordinates)
-    {
-//        System.out.println("Input coordinates: "+coordinates);
-//        System.out.println("Translation: "+_translation);
-        translate(coordinates);
-//        System.out.println("Translated coordinates: "+coordinates);
-        
-//        System.out.println("Rotation: "+_rotation);
-        rotate(coordinates);
-//        System.out.println("Rotated coordinates: "+coordinates);
-        
-//        return coordinates;
-    }
-    
-    public void translate(Hep3Vector coordinates)
-    {
-        Hep3Vector new_coordinates = VecOp.add(coordinates,_translation);
-        ((BasicHep3Vector)coordinates).setV(new_coordinates.x(),new_coordinates.y(),new_coordinates.z());
-    }
-    
-    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());
-    }
-     
-    // Return transformed vectors
-    public Hep3Vector transformed(Hep3Vector coordinates)
-    {    
-        return rotated(translated(coordinates));
-    }
-    
-    public Hep3Vector translated(Hep3Vector coordinates)
-    {
-        return VecOp.add(coordinates,_translation);
-    }
-    
-    public Hep3Vector rotated(Hep3Vector coordinates)
-    {
-        return VecOp.mult(_rotation.getRotationMatrix(),coordinates);
-    }
-    
-    // Invert the transformation
-    public void invert()
-    {
-        _translation = VecOp.mult(-1.0,VecOp.mult(_rotation.getRotationMatrix(),_translation));
-        _rotation.invert();
-    }
-    
-    public CoordinateTransformation3D inverse()
-    {
-        CoordinateTransformation3D transform = new CoordinateTransformation3D(
-                VecOp.mult(-1.0,VecOp.mult(_rotation.getRotationMatrix(),_translation)),
-                _rotation.inverse());
-        return transform;
-    }
-    
-    // Static functions
-    public static CoordinateTransformation3D multiply(CoordinateTransformation3D transformation1, CoordinateTransformation3D transformation2)
-    {
-        Rotation3D rotation = Rotation3D.multiply(transformation1.getRotation(),transformation2.getRotation());
-        Hep3Vector translation = VecOp.add(
-                VecOp.mult(transformation2.getRotation().inverse().getRotationMatrix(),transformation1.getTranslation()),
-                transformation2.getTranslation());
-        return new CoordinateTransformation3D(translation,rotation);
-    }
-    
-    // multiply in place
-    public void multiplyBy(ICoordinateTransformation3D transformation)
-    {
-        _rotation.multiplyBy(transformation.getRotation());
-        _translation = VecOp.add(
-                VecOp.mult(transformation.getRotation().inverse().getRotationMatrix(),_translation),
-                transformation.getTranslation());
-    }
-    
-    public String toString()
-    {
-    	return _translation.toString() + '\n' + _rotation.toString();
-    }
-    
-    public static CoordinateTransformation3D copy(ICoordinateTransformation3D ci)
-    {
-    	CoordinateTransformation3D c = (CoordinateTransformation3D)ci; 
-    	try { return (CoordinateTransformation3D)c.clone(); } catch (Throwable x) {}
-    	return null;
-    }
-    
-    public static CoordinateTransformation3D copy(CoordinateTransformation3D c)
-    {
-    	try {
-    		return (CoordinateTransformation3D)c.clone();
-    	}
-    	catch (Exception x)
-    	{}
-    	return null;
-    }
-}
\ No newline at end of file

GeomConverter/test/org/lcsim/detector
CoordinateTransformation3DTest.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- CoordinateTransformation3DTest.java	3 Mar 2007 13:34:01 -0000	1.6
+++ CoordinateTransformation3DTest.java	9 Mar 2007 22:23:55 -0000	1.7
@@ -1,6 +1,6 @@
 package org.lcsim.detector;
 
-import org.lcsim.detector.CoordinateTransformation3D;
+import org.lcsim.detector.Transform3D;
 import org.lcsim.detector.Rotation3D;
 
 import hep.physics.vec.BasicHep3Vector;
@@ -28,7 +28,7 @@
     {
     	System.out.println("CoordinateTransformation3DTest.testIdentityTransformation");
     	
-    	CoordinateTransformation3D transformation = new CoordinateTransformation3D();     
+    	Transform3D transformation = new Transform3D();     
     	Hep3Vector point = new BasicHep3Vector(1.0,2.0,3.0);
     	
     	Hep3Vector transformed_point = transformation.transformed(point);
@@ -46,7 +46,7 @@
         double random_y = random.nextDouble();
         double random_z = random.nextDouble();
         
-    	CoordinateTransformation3D transformation = new CoordinateTransformation3D(new BasicHep3Vector(random_x,random_y,random_z));
+    	Transform3D transformation = new Transform3D(new BasicHep3Vector(random_x,random_y,random_z));
     	Hep3Vector point = new BasicHep3Vector(1.0,2.0,3.0);
 
     	Hep3Vector transformed_point = transformation.transformed(point);
@@ -69,7 +69,7 @@
     	Rotation3D rotateX = new Rotation3D();
         
     	rotateX.setPassiveXYZ(Math.PI / 2, 0, 0);
-    	CoordinateTransformation3D transformation = new CoordinateTransformation3D(rotateX);
+    	Transform3D transformation = new Transform3D(rotateX);
 
     	Hep3Vector point = new BasicHep3Vector(0.0,0.0,1.0);
     	Hep3Vector result = transformation.transformed(point);
@@ -105,15 +105,15 @@
         rotation_2.setPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
         Hep3Vector translation_2 = new BasicHep3Vector(random.nextDouble(),random.nextDouble(),random.nextDouble());
 
-    	CoordinateTransformation3D transformation_1 = new CoordinateTransformation3D(translation_1,rotation_1);
-    	CoordinateTransformation3D transformation_2 = new CoordinateTransformation3D(translation_2,rotation_2);
+    	Transform3D transformation_1 = new Transform3D(translation_1,rotation_1);
+    	Transform3D 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);
        
-        CoordinateTransformation3D transformation_product = CoordinateTransformation3D.multiply(transformation_2,transformation_1);
+        Transform3D 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());
@@ -142,8 +142,8 @@
         rotation_2.setPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
         Hep3Vector translation_2 = new BasicHep3Vector(random.nextDouble(),random.nextDouble(),random.nextDouble());
 
-    	CoordinateTransformation3D transformation_1 = new CoordinateTransformation3D(translation_1,rotation_1);
-    	CoordinateTransformation3D transformation_2 = new CoordinateTransformation3D(translation_2,rotation_2);
+    	Transform3D transformation_1 = new Transform3D(translation_1,rotation_1);
+    	Transform3D transformation_2 = new Transform3D(translation_2,rotation_2);
         
         Hep3Vector point_1 = new BasicHep3Vector(1.0,2.0,3.0);
         Hep3Vector point_2 = new BasicHep3Vector(1.0,2.0,3.0);
@@ -175,7 +175,7 @@
         Rotation3D rotation = new Rotation3D();
         rotation.setPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
         Hep3Vector translation = new BasicHep3Vector(random.nextDouble(),random.nextDouble(),random.nextDouble());
-    	CoordinateTransformation3D transformation = new CoordinateTransformation3D(translation,rotation);
+    	Transform3D transformation = new Transform3D(translation,rotation);
         
         Hep3Vector point = new BasicHep3Vector(1.0,2.0,3.0);
         Hep3Vector transformed_point = transformation.transformed(point);
@@ -205,11 +205,11 @@
         rotation.setPassiveXYZ(random.nextDouble(),random.nextDouble(),random.nextDouble());
         Hep3Vector translation = new BasicHep3Vector(random.nextDouble(),random.nextDouble(),random.nextDouble());
 
-    	CoordinateTransformation3D transformation = new CoordinateTransformation3D(translation,rotation);  
+    	Transform3D transformation = new Transform3D(translation,rotation);  
         Hep3Vector point = new BasicHep3Vector(1.0,2.0,3.0);        
         Hep3Vector transformed_point = transformation.transformed(point);     
         
-        CoordinateTransformation3D transformation_inverted = transformation.inverse();
+        Transform3D transformation_inverted = transformation.inverse();
         transformed_point = transformation_inverted.transformed(transformed_point);
         
 //        System.out.println("x ratio: "+transformed_point.x()/point.x());
CVSspam 0.2.8