lcsim/src/org/lcsim/contrib/onoprien/vsegment/transform
diff -u -r1.2 -r1.3
--- RefFrameCartesian.java 15 Sep 2008 15:44:03 -0000 1.2
+++ RefFrameCartesian.java 3 Oct 2008 20:16:06 -0000 1.3
@@ -2,13 +2,16 @@
import hep.physics.matrix.SymmetricMatrix;
import hep.physics.vec.Hep3Vector;
+import org.lcsim.detector.IRotation3D;
import org.lcsim.detector.ITransform3D;
+import org.lcsim.detector.Transform3D;
+import org.lcsim.detector.Translation3D;
/**
* Cartesian reference frame.
*
* @author D. Onoprienko
- * @version $Id: RefFrameCartesian.java,v 1.2 2008/09/15 15:44:03 onoprien Exp $
+ * @version $Id: RefFrameCartesian.java,v 1.3 2008/10/03 20:16:06 onoprien Exp $
*/
public class RefFrameCartesian implements IRefFrame {
@@ -20,8 +23,18 @@
}
public RefFrameCartesian(ITransform3D to, ITransform3D from, Hep3Vector u, Hep3Vector v, Hep3Vector w) {
- _transTo = to;
- _transFrom = from;
+ this(to, from);
+ _u = u;
+ _v = v;
+ _w = w;
+ }
+
+ public RefFrameCartesian(Hep3Vector origin, IRotation3D rotationFrom) {
+ this(null, new Transform3D(new Translation3D(origin), rotationFrom));
+ }
+
+ public RefFrameCartesian(Hep3Vector origin, IRotation3D rotationFrom, Hep3Vector u, Hep3Vector v, Hep3Vector w) {
+ this(origin, rotationFrom);
_u = u;
_v = v;
_w = w;
@@ -36,22 +49,21 @@
/** Returns unit vector along U direction of this reference frame in the global coordinates. */
public Hep3Vector u() {
- return (_u == null) ? _transTo.transformed(ConstHep3Vector.V100) : _u;
+ return (_u == null) ? _transTo.rotated(ConstHep3Vector.V100) : _u;
}
/** Returns unit vector along V direction of this reference frame in the global coordinates. */
public Hep3Vector v() {
- return (_v == null) ? _transTo.transformed(ConstHep3Vector.V010) : _v;
+ return (_v == null) ? _transTo.rotated(ConstHep3Vector.V010) : _v;
}
/** Returns unit vector along W direction of this reference frame in the global coordinates. */
public Hep3Vector w() {
- return (_w == null) ? _transTo.transformed(ConstHep3Vector.V001) : _w;
+ return (_w == null) ? _transTo.rotated(ConstHep3Vector.V001) : _w;
}
public Hep3Vector getOrigin() {
- if (_transTo == null) _transTo = _transFrom.inverse();
- return _transTo.getTranslation().getTranslationVector();
+ return transformFrom(ConstHep3Vector.V000);
}
// -- Transformation : --------------------------------------------------------