GeomConverter/src/org/lcsim/detector
diff -u -r1.3 -r1.4
--- IRotation3D.java 28 Feb 2007 21:37:28 -0000 1.3
+++ IRotation3D.java 28 Feb 2007 21:44:34 -0000 1.4
@@ -16,7 +16,7 @@
*
* @author Tim Nelson <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: IRotation3D.java,v 1.3 2007/02/28 21:37:28 tknelson Exp $
+ * @version $Id: IRotation3D.java,v 1.4 2007/02/28 21:44:34 jeremy Exp $
*/
interface IRotation3D
{
@@ -140,33 +140,137 @@
* @return
*/
public double trace();
-
+
+ /**
+ * Get the XX component.
+ * @return
+ */
public double xx();
+
+ /**
+ * Get the XY component.
+ * @return
+ */
public double xy();
+
+ /**
+ * Get the XZ component.
+ * @return
+ */
public double xz();
+ /**
+ * Get the YX component.
+ * @return
+ */
public double yx();
+
+ /**
+ * Get the YY component.
+ * @return
+ */
public double yy();
+
+ /**
+ * Get the YZ component.
+ * @return
+ */
public double yz();
+ /**
+ * Get the ZX component.
+ * @return
+ */
public double zx();
+
+ /**
+ * Get the ZY component.
+ * @return
+ */
public double zy();
+
+ /**
+ * Get the ZZ component.
+ * @return
+ */
public double zz();
+ /**
+ * Get the X column.
+ * @return
+ */
public Hep3Vector getColumnX();
+
+ /**
+ * Get the Y column.
+ * @return
+ */
public Hep3Vector getColumnY();
+
+ /**
+ * Get the Z column.
+ * @return
+ */
public Hep3Vector getColumnZ();
+ /**
+ * Get the X row.
+ * @return
+ */
public Hep3Vector getRowX();
+
+ /**
+ * Get the Y row.
+ * @return
+ */
public Hep3Vector getRowY();
+
+ /**
+ * Get the Z row.
+ * @return
+ */
public Hep3Vector getRowZ();
+ /**
+ * Set the ith row using a Hep3Vector.
+ * @param row
+ * @param vec
+ */
public void setRow(int row, Hep3Vector vec);
+
+ /**
+ * Set the ith row using a double array.
+ * @param row
+ * @param vec
+ */
public void setRow(int row, double[] vec);
+
+ /**
+ * Set the ith row using arguments.
+ * @param row
+ * @param vec
+ */
public void setRow(int row, double a, double b, double c);
+ /**
+ * Set the ith column using a Hep3Vector.
+ * @param row
+ * @param vec
+ */
public void setColumn(int col, Hep3Vector vec);
+
+ /**
+ * Set the ith column using an array of doubles.
+ * @param row
+ * @param vec
+ */
public void setColumn(int col, double[] vec);
+
+ /**
+ * Set the ith column using arguments.
+ * @param row
+ * @param vec
+ */
public void setColumn(int col, double x, double y, double z);
public void setColumnX(Hep3Vector vec);
GeomConverter/src/org/lcsim/detector
diff -u -r1.7 -r1.8
--- Rotation3D.java 28 Feb 2007 21:37:29 -0000 1.7
+++ Rotation3D.java 28 Feb 2007 21:44:34 -0000 1.8
@@ -12,7 +12,7 @@
*
* @author Tim Nelson <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: Rotation3D.java,v 1.7 2007/02/28 21:37:29 tknelson Exp $
+ * @version $Id: Rotation3D.java,v 1.8 2007/02/28 21:44:34 jeremy Exp $
*/
public class Rotation3D implements IRotation3D
{
@@ -112,47 +112,47 @@
public double xx()
{
- return matrix.e(0,0);
+ return matrix.e(XRow,XCol);
}
public double xy()
{
- return matrix.e(0,1);
+ return matrix.e(XRow,YCol);
}
public double xz()
{
- return matrix.e(0,2);
+ return matrix.e(XRow,ZCol);
}
public double yx()
{
- return matrix.e(1,0);
+ return matrix.e(YRow,XCol);
}
public double yy()
{
- return matrix.e(1,1);
+ return matrix.e(YRow,YCol);
}
public double yz()
{
- return matrix.e(1,2);
+ return matrix.e(YRow,ZCol);
}
public double zx()
{
- return matrix.e(2,0);
+ return matrix.e(ZRow,XCol);
}
public double zy()
{
- return matrix.e(2,1);
+ return matrix.e(ZRow,YCol);
}
public double zz()
{
- return matrix.e(2,2);
+ return matrix.e(ZRow,ZCol);
}
public Hep3Vector getColumnX()
@@ -194,18 +194,38 @@
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.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());
+ buff.append(yx() + " " + yy() + " " + yz());
+ buff.append(zx() + " " + zy() + " " + zz());
+ buff.append('\n');
+ buff.append("]");
+ return buff.toString();
+ }
+ // This setColumn is where the error handling should go.
public void setColumn(int col, double[] arr)
{
- assert(col >=0 && col <=3);
- assert(arr.length>2);
+ 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]);
@@ -219,8 +239,14 @@
public void setRow(int row, double[] arr)
{
- assert(row >=0 && row <=3);
- assert(row >=0 && row <=3);
+ 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]);