Transform3D.icc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id:$
00003 // ---------------------------------------------------------------------------
00004 
00005 #include "CLHEP/Vector/ThreeVector.h"
00006 #include "CLHEP/Vector/Rotation.h"
00007 #include "CLHEP/Geometry/Point3D.h"
00008 #include "CLHEP/Geometry/Vector3D.h"
00009 #include "CLHEP/Geometry/Normal3D.h"
00010 
00011 namespace HepGeom {
00012 
00013 //   I N L I N E S   F O R   T R A N S F O R M A T I O N
00014 
00015 inline
00016 Transform3D::Transform3D_row::Transform3D_row
00017 (const Transform3D & r, int i) : rr(r), ii(i) {}
00018 
00019 inline
00020 double Transform3D::Transform3D_row::operator[](int jj) const {
00021   return rr(ii,jj);
00022 }
00023 
00024 inline
00025 const Transform3D::Transform3D_row Transform3D::operator[](int i) const {
00026   return Transform3D_row(*this, i);
00027 }
00028 
00029 inline
00030 Transform3D::Transform3D(const CLHEP::HepRotation & m, const CLHEP::Hep3Vector & v) {
00031   xx_= m.xx(); xy_= m.xy(); xz_= m.xz();
00032   yx_= m.yx(); yy_= m.yy(); yz_= m.yz();
00033   zx_= m.zx(); zy_= m.zy(); zz_= m.zz();
00034   dx_= v.x();  dy_= v.y();  dz_= v.z();
00035 }
00036 
00037 inline
00038 CLHEP::HepRotation
00039 Transform3D::getRotation() const {
00040   CLHEP::HepRotation m;
00041   return m.rotateAxes(CLHEP::Hep3Vector(xx_,yx_,zx_),
00042                       CLHEP::Hep3Vector(xy_,yy_,zy_),
00043                       CLHEP::Hep3Vector(xz_,yz_,zz_));
00044 }
00045 
00046 inline
00047 CLHEP::Hep3Vector
00048 Transform3D::getTranslation() const {
00049   return CLHEP::Hep3Vector(dx_,dy_,dz_); 
00050 }
00051 
00052 //   I N L I N E S   F O R   R O T A T I O N
00053 
00054 inline
00055 Rotate3D::Rotate3D(const CLHEP::HepRotation & m) {
00056   xx_= m.xx(); xy_= m.xy(); xz_= m.xz();
00057   yx_= m.yx(); yy_= m.yy(); yz_= m.yz();
00058   zx_= m.zx(); zy_= m.zy(); zz_= m.zz();
00059   dx_= 0;      dy_= 0;      dz_= 0;
00060 }
00061 
00062 inline
00063 Rotate3D::Rotate3D(double a, const Vector3D<double> & v) {
00064   *this =
00065     Rotate3D(a, Point3D<double>(0,0,0), Point3D<double>(v.x(),v.y(),v.z()));
00066 }
00067 
00068 inline
00069 Rotate3D::Rotate3D(const Point3D<double> & fr1, const Point3D<double> & fr2,
00070                    const Point3D<double> & to1, const Point3D<double> & to2)
00071   : Transform3D(Point3D<double>(0,0,0),fr1,fr2,
00072                 Point3D<double>(0,0,0),to1,to2) {}
00073 
00074 //   I N L I N E S   F O R   T R A N S L A T I O N
00075 
00076 inline
00077 Translate3D::Translate3D(const CLHEP::Hep3Vector & v)
00078   : Transform3D(1,0,0,v.x(), 0,1,0,v.y(), 0,0,1,v.z()) {}
00079 
00080 //   I N L I N E S   F O R   R E F L E C T I O N
00081 
00082 inline
00083 Reflect3D::Reflect3D(const Normal3D<double> & n, const Point3D<double> & p) {
00084   *this = Reflect3D(n.x(), n.y(), n.z(), -n*p);
00085 }
00086 
00087 } /* namespace HepGeom */

Generated on Mon May 27 17:50:36 2013 for Geant4 by  doxygen 1.4.7