3 // ---------------------------------------------------------------------------
5 #include "CLHEP/Vector/ThreeVector.h"
6 #include "CLHEP/Vector/Rotation.h"
7 #include "CLHEP/Geometry/Point3D.h"
8 #include "CLHEP/Geometry/Vector3D.h"
9 #include "CLHEP/Geometry/Normal3D.h"
13 // I N L I N E S F O R T R A N S F O R M A T I O N
16 Transform3D::Transform3D_row::Transform3D_row
17 (const Transform3D & r, int i) : rr(r), ii(i) {}
20 double Transform3D::Transform3D_row::operator[](int jj) const {
25 const Transform3D::Transform3D_row Transform3D::operator[](int i) const {
26 return Transform3D_row(*this, i);
30 Transform3D::Transform3D(const CLHEP::HepRotation & m, const CLHEP::Hep3Vector & v) {
31 xx_= m.xx(); xy_= m.xy(); xz_= m.xz();
32 yx_= m.yx(); yy_= m.yy(); yz_= m.yz();
33 zx_= m.zx(); zy_= m.zy(); zz_= m.zz();
34 dx_= v.x(); dy_= v.y(); dz_= v.z();
39 Transform3D::getRotation() const {
41 return m.rotateAxes(CLHEP::Hep3Vector(xx_,yx_,zx_),
42 CLHEP::Hep3Vector(xy_,yy_,zy_),
43 CLHEP::Hep3Vector(xz_,yz_,zz_));
48 Transform3D::getTranslation() const {
49 return CLHEP::Hep3Vector(dx_,dy_,dz_);
52 // I N L I N E S F O R R O T A T I O N
55 Rotate3D::Rotate3D(const CLHEP::HepRotation & m) {
56 xx_= m.xx(); xy_= m.xy(); xz_= m.xz();
57 yx_= m.yx(); yy_= m.yy(); yz_= m.yz();
58 zx_= m.zx(); zy_= m.zy(); zz_= m.zz();
59 dx_= 0; dy_= 0; dz_= 0;
63 Rotate3D::Rotate3D(double a, const Vector3D<double> & v) {
65 Rotate3D(a, Point3D<double>(0,0,0), Point3D<double>(v.x(),v.y(),v.z()));
69 Rotate3D::Rotate3D(const Point3D<double> & fr1, const Point3D<double> & fr2,
70 const Point3D<double> & to1, const Point3D<double> & to2)
71 : Transform3D(Point3D<double>(0,0,0),fr1,fr2,
72 Point3D<double>(0,0,0),to1,to2) {}
74 // I N L I N E S F O R T R A N S L A T I O N
77 Translate3D::Translate3D(const CLHEP::Hep3Vector & v)
78 : Transform3D(1,0,0,v.x(), 0,1,0,v.y(), 0,0,1,v.z()) {}
80 // I N L I N E S F O R R E F L E C T I O N
83 Reflect3D::Reflect3D(const Normal3D<double> & n, const Point3D<double> & p) {
84 *this = Reflect3D(n.x(), n.y(), n.z(), -n*p);
87 } /* namespace HepGeom */