Commit in GeomConverter/src/org/lcsim/detector on MAIN
ICoordinateTransformation3D.java+27added 1.1
IRotation3D.java+97added 1.1
CoordinateTransformation3D.java+24-121.1 -> 1.2
Rotation3D.java+415-2001.1 -> 1.2
+563-212
2 added + 2 modified, total 4 files
JM: Dev code.

GeomConverter/src/org/lcsim/detector
ICoordinateTransformation3D.java added at 1.1
diff -N ICoordinateTransformation3D.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ICoordinateTransformation3D.java	26 Feb 2007 19:25:19 -0000	1.1
@@ -0,0 +1,27 @@
+/*
+ * ICoordinateTransformation3D.java
+ */
+
+package org.lcsim.detector;
+
+import hep.physics.vec.Hep3Vector;
+
+/**
+ *
+ * @author tknelson
+ */
+public interface ICoordinateTransformation3D
+{       
+    // Access to translation and rotation
+    public Hep3Vector getTranslation();
+    public Rotation3D getRotation();
+    
+    // Transformations
+    public Hep3Vector transform(Hep3Vector coordinates);
+    public Hep3Vector translate(Hep3Vector coordinates);    
+    public Hep3Vector rotate(Hep3Vector coordinates);    
+    
+    public void mult(ICoordinateTransformation3D trans);
+    
+    public void invert();
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector
IRotation3D.java added at 1.1
diff -N IRotation3D.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ IRotation3D.java	26 Feb 2007 19:25:19 -0000	1.1
@@ -0,0 +1,97 @@
+package org.lcsim.detector;
+
+import hep.physics.vec.BasicHep3Matrix;
+import hep.physics.vec.Hep3Matrix;
+import hep.physics.vec.Hep3Vector;
+
+// interface to rotations in 3D space
+interface IRotation3D
+{    
+	public static final int XCol=0, YCol=1, ZCol=2,XRow=0,YRow=1,ZRow=2;
+	public static final int XX=0, XY=1, XZ=2, YX=3, YY=4, YZ=5, ZX=6, ZY=7, ZZ=8;
+	
+	// returns a copy of the rotation matrix
+	public BasicHep3Matrix getRotationMatrix();   
+
+	public void setRotationMatrix(Hep3Matrix matrix);
+	public void setRotationMatrix(BasicHep3Matrix matrix);
+    public void setRotationMatrix(double [][] arr);    
+    
+    public void setTaitBryan(double alpha, double beta, double gamma);
+    public void setPassiveEuler(double phi, double theta, double psi);
+    public void setActiveEuler(double phi, double theta, double psi);
+    
+    public void setComponents(double xx, double xy, double xz, double yx, double yy, double yz, double zx, double zy, double zz);
+    public double[] getComponents();
+    
+    public void invert();
+    public IRotation3D inverse();
+    public double trace();
+    
+    public double xx();
+    public double xy();
+    public double xz();
+    
+    public double yx();
+    public double yy();
+    public double yz();
+    
+    public double zx();
+    public double zy();
+    public double zz();
+    
+    // these return new objects
+    // and don't effect the rotation
+    // in place; use set methods
+    public Hep3Vector getColumnX();
+    public Hep3Vector getColumnY();    
+    public Hep3Vector getColumnZ();
+    
+    public Hep3Vector getRowX();
+    public Hep3Vector getRowY();
+    public Hep3Vector getRowZ();    
+    
+    public void setRow(int row, Hep3Vector vec);
+    public void setRow(int row, double[] vec);
+    public void setRow(int row, double a, double b, double c);
+    
+    public void setColumn(int col, Hep3Vector vec);
+    public void setColumn(int col, double[] vec);
+    public void setColumn(int col, double x, double y, double z);
+    
+    public void setColumnX(Hep3Vector vec);
+    public void setColumnX(double[] arr);
+    public void setColumnX(double x, double y, double z);
+    
+    public void setColumnY(Hep3Vector vec);
+    public void setColumnY(double [] arr);
+    public void setColumnY(double x, double y, double z);
+    
+    public void setColumnZ(Hep3Vector vec);
+    public void setColumnZ(double [] arr);
+    public void setColumnZ(double x, double y, double z);
+    
+    public void setRowX(Hep3Vector vec);
+    public void setRowX(double [] arr);
+    public void setRowX(double x, double y, double z);
+    
+    public void setRowY(Hep3Vector vec);
+    public void setRowY(double [] arr);
+    public void setRowY(double x, double y, double z);
+    
+    public void setRowZ(Hep3Vector vec);
+    public void setRowZ(double [] arr);
+    public void setRowZ(double x, double y, double z);
+
+    // set element
+    public void set(int row, int col, double v);
+    
+    // get element
+    public double get(int row, int col);
+    
+    // get ith element
+    public double get(int i);
+
+    // resets the rotation to the identity matrix
+    public void resetToIdentity();
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/detector
CoordinateTransformation3D.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- CoordinateTransformation3D.java	24 Feb 2007 03:19:24 -0000	1.1
+++ CoordinateTransformation3D.java	26 Feb 2007 19:25:19 -0000	1.2
@@ -12,7 +12,7 @@
  *
  * @author tknelson
  */
-public class CoordinateTransformation3D
+public class CoordinateTransformation3D implements ICoordinateTransformation3D
 {
     
     // Fields
@@ -42,6 +42,12 @@
         _rotation = rotation;
     }
     
+    public CoordinateTransformation3D(Hep3Vector translation, IRotation3D rotation)
+    {
+    	_translation = translation;
+    	_rotation = (Rotation3D)rotation;
+    }
+    
     // Access to translation and rotation
     public Hep3Vector getTranslation()
     {
@@ -69,32 +75,38 @@
     public Hep3Vector rotate(Hep3Vector coordinates)
     {
         //return VecOp.mult(_rotation,coordinates);
-    	return VecOp.mult(_rotation.getMatrix(),coordinates);
+    	return VecOp.mult(_rotation.getRotationMatrix(),coordinates);
     }
      
     // Invert the transformation
     public void invert()
     {
-        _translation = VecOp.mult(-1.0,VecOp.mult(_rotation.getMatrix(),_translation));
+        _translation = VecOp.mult(-1.0,VecOp.mult(_rotation.getRotationMatrix(),_translation));
         _rotation.invert(); // Need to assure that transpose is used        
     }
     
     // FIXME: Talk to Tony about supporting this pattern
     
-//    public CoordinateTransformation3D inverse()
-//    {
-//        CoordinateTransformation3D transform = new CoordinateTransformation3D(
-//                VecOp.mult(-1.0,VecOp.mult(_rotation,_translation)),
-//                _rotation.inverse()); // FIXME: Need to assure that transpose is used
-//        return transform;
-//    }
+    public CoordinateTransformation3D inverse()
+    {
+        CoordinateTransformation3D transform = new CoordinateTransformation3D(
+                VecOp.mult(-1.0,VecOp.mult(_rotation.getRotationMatrix(),_translation)),
+                _rotation.inverse()); // FIXME: Need to assure that transpose is used
+        return transform;
+    }
     
     // Static functions
     public static CoordinateTransformation3D mult(CoordinateTransformation3D transformation1, CoordinateTransformation3D transformation2)
     {
-        Rotation3D rotation = new Rotation3D(VecOp.mult(transformation1.getRotation().getMatrix(),transformation2.getRotation().getMatrix()));
-        Hep3Vector translation = VecOp.add(VecOp.mult(transformation1.getRotation().getMatrix(),transformation2.getTranslation()),transformation1.getTranslation());
+        Rotation3D rotation = new Rotation3D(VecOp.mult(transformation1.getRotation().getRotationMatrix(),transformation2.getRotation().getRotationMatrix()));
+        Hep3Vector translation = VecOp.add(VecOp.mult(transformation1.getRotation().getRotationMatrix(),transformation2.getTranslation()),transformation1.getTranslation());
         return new CoordinateTransformation3D(translation,rotation);
     }
     
+    // multiply in place
+    public void mult(ICoordinateTransformation3D transformation)
+    {
+    	_rotation.setRotationMatrix(VecOp.mult(_rotation.getRotationMatrix(), transformation.getRotation().getRotationMatrix()));
+    	_translation = VecOp.add(_translation, transformation.getTranslation());
+    }
 }

GeomConverter/src/org/lcsim/detector
Rotation3D.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- Rotation3D.java	24 Feb 2007 03:19:24 -0000	1.1
+++ Rotation3D.java	26 Feb 2007 19:25:19 -0000	1.2
@@ -2,14 +2,11 @@
  * Hep3Rotation.java
  */
 
-//package org.lcsim.contrib.subdetector.tracker.silicon;
-
 package org.lcsim.detector;
 
 import hep.physics.vec.BasicHep3Matrix;
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.BasicHep3Matrix;
 import hep.physics.vec.Hep3Matrix;
 import hep.physics.vec.VecOp;
 
@@ -17,204 +14,422 @@
 
 /**
  *
- * @author tknelson
+ * @author Tim Nelson <[log in to unmask]>
+ * @author Jeremy McCormick <[log in to unmask]>
  */
-public class Rotation3D
+public class Rotation3D implements IRotation3D
 {
-    private BasicHep3Matrix matrix = BasicHep3Matrix.identity();
+	public static final int XCol=0, YCol=1, ZCol=2,XRow=0,YRow=1,ZRow=2;
+
+	private BasicHep3Matrix matrix = BasicHep3Matrix.identity();
+
+	public Rotation3D()
+	{}
+
+	public void setRotationMatrix(Hep3Matrix matrix)
+	{
+		this.matrix = (BasicHep3Matrix)matrix;
+	}
+	
+	/**
+	 * Transform rotation using Tait-Bryan convention.
+	 * @param alpha
+	 * @param beta
+	 * @param gamma
+	 */
+	public void setTaitBryan(double alpha, double beta, double gamma)
+	{
+		matrix = passiveTaitBryan(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);
+	}
+
+	// Static Methods
+	//===============
+	public static BasicHep3Matrix passiveEuler(double phi, double theta, double psi)
+	{
+		BasicHep3Matrix matrix = new BasicHep3Matrix();
+		matrix.setPassiveEuler(phi,theta,psi);
+		return matrix;
+	}
+
+	public static BasicHep3Matrix passiveTaitBryan(double alpha, double beta, double gamma)
+	{
+		return (BasicHep3Matrix)VecOp.mult(passiveZRotation(gamma),VecOp.mult(passiveYRotation(beta),passiveXRotation(alpha)));                
+	}
+
+	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;
+	}
+
+	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;
+	}
+
+	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;
+	}    
+
+	public void invert()
+	{
+		matrix.transpose();
+	}
+
+	public IRotation3D inverse()
+	{
+		BasicHep3Matrix inversematrix = new BasicHep3Matrix(matrix);
+		inversematrix.invert();
+		return new Rotation3D(inversematrix);
+	}
+
+	public double xx()
+	{
+		return matrix.e(0,0);
+	}
+
+	public double xy()
+	{
+		return matrix.e(0,1);
+	}
+
+	public double xz()
+	{
+		return matrix.e(0,2);
+	}
+
+	public double yx()
+	{
+		return matrix.e(1,0);
+	}
+
+	public double yy()
+	{
+		return matrix.e(1,1);
+	}
+
+	public double yz()
+	{
+		return matrix.e(1,2);
+	}
+
+	public double zx()
+	{
+		return matrix.e(2,0);
+	}
+
+	public double zy()
+	{
+		return matrix.e(2,1);
+	}
+
+	public double zz()
+	{
+		return matrix.e(2,2);
+	}
+
+	public Hep3Vector getColumnX()
+	{
+		return new BasicHep3Vector(xx(),yx(),zx());
+	}
+
+	public Hep3Vector getColumnY()
+	{
+		return new BasicHep3Vector(xy(),yy(),zy());
+	}
+
+	public Hep3Vector getColumnZ()
+	{
+		return new BasicHep3Vector(xz(),yz(),zz());
+	}
+
+	public Hep3Vector getRowX()
+	{
+		return new BasicHep3Vector(xx(),xy(),xz());
+	}
+
+	public Hep3Vector getRowY()
+	{
+		return new BasicHep3Vector(yx(),yy(),yz());
+	}
+
+	public Hep3Vector getRowZ()
+	{
+		return new BasicHep3Vector(zx(),zy(),zz());
+	}
+
+	public void printOut(PrintStream ps)
+	{
+		ps.print("[");
+		ps.println();
+
+		BasicHep3Matrix m = getRotationMatrix();
+
+		for (int i=0; i<3; i++)
+		{
+			ps.printf("%.4f %.4f %.4f", m.e(i,0), m.e(i,1), m.e(i,2));
+			ps.println();
+		}    	    	    	    	    
+
+		ps.print("]");
+		ps.println('\n');
+	}
+
+	public void setColumn(int col, double[] arr)
+	{
+		assert(col >=0 && col <=3);
+		assert(arr.length>2);
+		for (int i=0; i<3; i++)
+		{
+			set(i,col,arr[i]);
+		}
+	}
+
+	public void setColumn(int col, Hep3Vector vec)
+	{
+		setColumn(col,vec.v());
+	}
+
+	public void setRow(int row, double[] arr)
+	{
+		assert(row >=0 && row <=3);
+		assert(row >=0 && row <=3);
+		for (int i=0; i<3; i++)
+		{
+			set(row, i, arr[i]);
+		}
+	}    
+
+	public void setRow(int row, Hep3Vector vec)
+	{
+		setRow(row,vec.v());
+	}
+
+	public void setColumnX(double[] arr) {
+		setColumn(0,arr);
+	}
+
+	public void setColumnX(Hep3Vector vec) {
+		setColumnX(vec.v());
+	}
+
+	public void setColumnY(double[] arr) 
+	{
+		setColumn(1,arr);
+	}
+
+	public void setColumnY(Hep3Vector vec) {
+		setColumnY(vec.v());		
+	}
+
+	public void setColumnZ(double[] arr) 
+	{
+		setColumn(2,arr);		
+	}
+
+	public void setColumnZ(Hep3Vector vec) {
+		setColumnZ(vec.v());		
+	}
+
+	public void setRowX(double[] arr) {
+		setRow(0,arr);		
+	}
+
+	public void setRowX(Hep3Vector vec) 
+	{		
+		setRowX(vec.v());
+	}
+
+	public void setRowY(double[] arr) 
+	{
+		setRow(1,arr);
+	}
+
+	public void setRowY(Hep3Vector vec) {
+		setRowY(vec.v());		
+	}
+
+	public void setRowZ(double[] arr) {
+		setRow(2,arr);		
+	}
+
+	public void setRowZ(Hep3Vector vec) {
+		setRowZ(vec.v());		
+	}
+
+	public Rotation3D(BasicHep3Matrix matrix)
+	{
+		setRotationMatrix(matrix);
+	}
+
+	public Rotation3D(Hep3Matrix matrix)
+	{
+		setRotationMatrix((BasicHep3Matrix)matrix);
+	}    
+
+	public void set(int i, int j, double v)
+	{
+		matrix.setElement(i,j,v);
+	}
+
+	public void setColumn(int col, double x, double y, double z) 
+	{
+		setColumn(col, new double[]{x,y,z});
+	}
+
+	public void setColumnX(double x, double y, double z) {
+		setColumnX(new double[]{x,y,z});		
+	}
+
+	public void setColumnY(double x, double y, double z) {
+		setColumnY(new double[]{x,y,z});		
+	}
+
+	public void setColumnZ(double x, double y, double z) {
+		setColumnZ(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)
+	{		
+		set(0,0,xx);
+		set(0,1,xy);
+		set(0,2,xz);
+	}
+
+	public void setRowY(double yx, double yy, double yz)
+	{
+		set(0,0,yx);
+		set(0,1,yy);
+		set(0,2,yz);
+	}
+
+	public void setRowZ(double zx, double zy, double zz)
+	{
+		set(0,0,zx);
+		set(0,1,zy);
+		set(0,2,zz);
+	}
+
+	// set from row,col array of at least size 3x3
+	public void setRotationMatrix(double [][] a)
+	{        
+		matrix = new BasicHep3Matrix();
+		for (int i=0; i<3; i++)
+		{
+			for (int j=0; j<3; j++)
+			{
+				set(i, j, a[i][j]);
+			}
+		}
+	}
+
+	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 get(int r, int c)
+	{
+		return matrix.e(r,c);
+	}
 	
-    // Fields
-    //=======
-    /**
-     * Create a new Hep3Rotation containing the identify matrix.
-     */
-    public Rotation3D()
-    {}
-    
-    /**
-     * Create a new Hep3Rotation from a 3x3 matrix.
-     * @param matrix
-     */
-    public Rotation3D(BasicHep3Matrix matrix)
-    {
-    	setMatrix(matrix);
-    }
-    
-    public Rotation3D(Hep3Matrix matrix)
-    {
-    	setMatrix((BasicHep3Matrix)matrix);
-    }
-    
-    public BasicHep3Matrix getMatrix()
-    {
-    	return this.matrix;
-    }
-    
-    public void setMatrix(BasicHep3Matrix matrix)
-    {
-    	this.matrix = matrix;
-    }
-    
-    /**
-     * Transform rotation using Tait-Bryan convention.
-     * @param alpha
-     * @param beta
-     * @param gamma
-     */
-    public void setTaitBryan(double alpha, double beta, double gamma)
-    {
-    	matrix = passiveTaitBryan(alpha,beta,gamma);
-    }
-    
-    public void setPassiveEuler(double phi, double theta, double psi)
-    {
-    	matrix.setPassiveEuler(phi,theta,psi); 
-    }
-    
-    public static BasicHep3Matrix passiveEuler(double phi, double theta, double psi)
-    {
-    	BasicHep3Matrix matrix = new BasicHep3Matrix();
-    	matrix.setPassiveEuler(phi,theta,psi);
-    	return matrix;
-    }
-
-    // Static Methods
-    //===============
-    public static BasicHep3Matrix passiveTaitBryan(double alpha, double beta, double gamma)
-    {
-        return (BasicHep3Matrix)VecOp.mult(passiveZRotation(gamma),VecOp.mult(passiveYRotation(beta),passiveXRotation(alpha)));                
-    }
-      
-    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;
-    }
-    
-    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;
-    }
-    
-    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;
-    }    
-    
-    public void invert()
-    {
-    	matrix.transpose();
-    }
-        
-    public double xx()
-    {
-    	return matrix.e(0,0);
-    }
-    
-    public double xy()
-    {
-    	return matrix.e(0,1);
-    }
-    
-    public double xz()
-    {
-    	return matrix.e(0,2);
-    }
-    
-    public double yx()
-    {
-    	return matrix.e(1,0);
-    }
-    
-    public double yy()
-    {
-    	return matrix.e(1,1);
-    }
-    
-    public double yz()
-    {
-    	return matrix.e(1,2);
-    }
-    
-    public double zx()
-    {
-    	return matrix.e(2,0);
-    }
-    
-    public double zy()
-    {
-    	return matrix.e(2,1);
-    }
-    
-    public double zz()
-    {
-    	return matrix.e(2,2);
-    }
-    
-    Hep3Vector colX()
-    {
-    	return new BasicHep3Vector(matrix.e(0,0),matrix.e(1,0),matrix.e(2,0));
-    }
-    
-    Hep3Vector colY()
-    {
-    	return new BasicHep3Vector(matrix.e(0,1),matrix.e(1,1),matrix.e(2,1));
-    }
-    
-    Hep3Vector colZ()
-    {
-    	return new BasicHep3Vector(matrix.e(0,2),matrix.e(1,2),matrix.e(2,2));
-    }
-    
-    Hep3Vector rowX()
-    {
-    	return new BasicHep3Vector(matrix.e(0,0),matrix.e(0,1),matrix.e(0,2));
-    }
-    
-    Hep3Vector rowY()
-    {
-    	return new BasicHep3Vector(matrix.e(1,0),matrix.e(1,1),matrix.e(1,2));
-    }
-
-    Hep3Vector rowZ()
-    {
-    	return new BasicHep3Vector(matrix.e(2,0),matrix.e(2,1),matrix.e(2,2));
-    }
-    
-    public void printOut(PrintStream ps)
-    {
-    	ps.print("[");
-    	ps.println();
-    	
-    	BasicHep3Matrix m = getMatrix();
-    	
-    	for (int i=0; i<3; i++)
-    	{
-    		ps.printf("%.4f %.4f %.4f", m.e(i,0), m.e(i,1), m.e(i,2));
-    		ps.println();
-    	}    	    	    	    	    
-    			
-    	ps.print("]");
-    	ps.println('\n');
-    }
+	public double get(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 );					
+		}
+	}	
 }
\ No newline at end of file
CVSspam 0.2.8