1 package org.lcsim.detector; 2 3 import hep.physics.matrix.SymmetricMatrix; 4 import hep.physics.vec.Hep3Matrix; 5 import hep.physics.vec.Hep3Vector; 6 7 import java.io.PrintStream; 8 9 /** 10 * An interface to rotations in 3D space, using interfaces and base classes from 11 * <a href="http://java.freehep.org/freehep-physics/">freehep physics</a>. 12 * 13 * @author Tim Nelson <tknelson@slac.stanford.edu> 14 * @author Jeremy McCormick <jeremym@slac.stanford.edu> 15 * 16 * @version $Id: IRotation3D.java,v 1.11 2010/04/14 17:52:32 jeremy Exp $ 17 */ 18 public interface IRotation3D 19 { 20 /** 21 * Numerical constants for the X and Y column indices. 22 */ 23 public static final int XCol=0, YCol=1, ZCol=2,XRow=0,YRow=1,ZRow=2; 24 25 /** 26 * The number of rows and columns in the matrix. 27 */ 28 public static final int NRows=3,NCols=3; 29 30 /** 31 * The rotation in standard rotation matrix form. 32 * @return The BasicHep3Matrix representing this rotation. 33 */ 34 public Hep3Matrix getRotationMatrix(); 35 36 /** 37 * Set the matrix from a Hep3Matrix interface. 38 * @param matrix 39 */ 40 public void setRotationMatrix(Hep3Matrix matrix); 41 42 /** 43 * Multiply this rotation in place with another IRotation3D, 44 * modifying this IRotation3D in place. 45 * @param rotation 46 */ 47 public void multiplyBy(IRotation3D rotation); 48 49 /** 50 * Rotate a Hep3Vector in place 51 * @param coordinates 52 */ 53 public void rotate(Hep3Vector coordinates); 54 55 /** 56 * Rotate a Hep3Vector 57 * @param coordinates 58 * @return rotated Hep3Vector 59 */ 60 public Hep3Vector rotated(Hep3Vector coordinates); 61 62 /** 63 * Rotate a SymmetricMatrix in place (e.g. covariance matrix) 64 * @param matrix 65 */ 66 public void rotate(SymmetricMatrix matrix); 67 68 /** 69 * Rotate a SymmetricMatrix (e.g. covariance matrix) 70 * @param matrix 71 * @return rotated SymmetricMatrix 72 */ 73 public SymmetricMatrix rotated(SymmetricMatrix matrix); 74 75 /** 76 * Compare this IRotation3D with another. 77 * @param rotation 78 * @return True if all components of the matrices are equal. 79 */ 80 public boolean equals(IRotation3D rotation); 81 82 /** 83 * Apply inverse transformation in place. 84 */ 85 public void invert(); 86 87 /** 88 * Apply inverse transformation, returning 89 * a new IRotation3D, not altering this matrix. 90 * @return A new matrix which is the inverse of this one. 91 */ 92 public IRotation3D inverse(); 93 94 /** 95 * Get matrix component by row and column. 96 * @param row 97 * @param col 98 * @return Matrix component at row and col. 99 */ 100 public double getComponent(int row, int col); 101 102 /** 103 * Reset this IRotation3D to the identity matrix. 104 */ 105 public void resetToIdentity(); 106 107 /** 108 * True if this IRotation3D is equivalent to the identity matrix. 109 * @return True if this rotation is equal to identity. 110 */ 111 public boolean isIdentity(); 112 113 /** 114 * Print out rotation 115 * @param PrintStream for output 116 */ 117 public void printOut(PrintStream ps); 118 119 }